• What do you need help with? Version 5
    5,752 replies, posted
[QUOTE=Topgamer7;38731283]Look up Integer.toString.[/QUOTE] I actually found a way, but thanks anyway. I did this: Consider 256. 256 % 10 = 6(It's rounded to 6). 256 % 100 / 10 = 5(It's rounded to 5). 256 % 1000 / 100 = 2(It's rounded to 2).
Conversion to a string does that same thing behind the scenes. In interpreted languages the string conversion can be faster.
What is the best/least confusing IDE for Java?
[QUOTE=Wealth + Taste;38731510]What is the best/least confusing IDE for Java?[/QUOTE] It's really a matter of what you like/prefer when programming. I use Eclipse as it's easy, simple, and has everything I need. I know another popular one is NetBeans, but I haven't really tried that one. I would suggest Eclipse.
Yeah I tried Netbeans and it seems really complicated. I don't know if all IDEs are or Netbeans in particular is. I'll try Eclipse. Thanks!
Can someone lead me to a good tutorial on depth buffers and stencil testing with OpenGL? The one on open.gl is confusing and I learned nothing from that.
Where can I get some ideas on what to program? I want to start back up but I want to learn from doing and not reading books.
So about two days ago I got Far Cry 3, it's a pretty amazing game but there's something in the editor that really grabbed my attention, multi-selection in 3D. Does anyone here have a clue regarding how you could achieve this? I thought of creating a cube that would extend from the frustum near plane all the way to the far plane, the dimension would be adjusted using the mouse position and it would always be aligned with the camera direction, however I ran into some problems while trying to implement it. First of all, how can you detect if a point in inside a volume that is being rotated? When doing basic AABB for my object I first translated the box THEN I extended it using the rotation matrix, it works pretty well, but it's not possible for something like a selection box. I also tried to extract the planes from an ortho projection matrix thinking I could maybe "fake" a volume using a frustum shaped like a box but it did not work. I feel like I'm missing something, I can easily reproduced the selection box but it's at the end of my pipeline after all the transformation as been done, I need the process to be entirely done on the CPU. [IMG]http://i50.tinypic.com/144ctgg.png[/IMG]
If you have an ortho projection you can use a cube. Otherwise you have to use a frustum. To do the screen to world coordinate conversion, you have to multiply your point with the inverse camera , then screen(projection) matrix. glUnproject will do everything of the above for you. To get a "rotated bounding box collision" you convert the objects you're testing against into the local coordinate system (of the box). Just google the term and you'll find lots of tutorials. [editline]7th December 2012[/editline] [QUOTE=Felheart;38728880] In OpenGL I have the functions VertexPointer, ColorPointer, TexCoordPointer and so on. Assume I have a VBO that contains only vertex-positions. Now I just want to provide [U]one additional byte per vertex[/U] and [U]access them in the vertexshader[/U]. How would I do that? I cannot use texcoord since the smallest texcoord size is 2bytes and I also might want to use texcoords later on. I need a function like VertexPointer but not for vertex-positions but for bytes. Something like MyArbitraryPointer(...);[/QUOTE] I managed to totally abuse GL.ColorPointer(...) by using 4 "colors" and unsignedByte as datatype. And then converting that successfully using that data in my shaders. Is that ok if it work?? Or are there better alternatives?
[QUOTE=HiredK;38732288]So about two days ago I got Far Cry 3, it's a pretty amazing game but there's something in the editor that really grabbed my attention, multi-selection in 3D. Does anyone here have a clue regarding how you could achieve this? I thought of creating a cube that would extend from the frustum near plane all the way to the far plane, the dimension would be adjusted using the mouse position and it would always be aligned with the camera direction, however I ran into some problems while trying to implement it. First of all, how can you detect if a point in inside a volume that is being rotated? When doing basic AABB for my object I first translated the box THEN I extended it using the rotation matrix, it works pretty well, but it's not possible for something like a selection box. I also tried to extract the planes from an ortho projection matrix thinking I could maybe "fake" a volume using a frustum shaped like a box but it did not work. I feel like I'm missing something, I can easily reproduced the selection box but it's at the end of my pipeline after all the transformation as been done, I need the process to be entirely done on the CPU. [IMG]http://i50.tinypic.com/144ctgg.png[/IMG][/QUOTE] Besides the way Felheart mentioned, you can also do this by color picking. Give each selectable object a unique color and draw only it's vertices with that color. Then you get the color at the cursor coordinate (or in this case, all the pixel colors within the selection box), and lookup the original objects from the colors.
-snip-
I have a 25x25 (2d) grid of squares in a multidemensional array (floor[x][y]), I want to do a "wave" of changing the colour of each of them, starting off from a central point, in a sort of circle around the central point. I don't have the problems with changing a colour of them or anything and is such not relevant, but I am having trouble of thinking of a way to implement a roughly circular wave of them changing, while not changing the ones that have already been changed (while having it be reusable an indefinite amount of times).
[QUOTE=Wealth + Taste;38731697]Yeah I tried Netbeans and it seems really complicated. I don't know if all IDEs are or Netbeans in particular is. I'll try Eclipse. Thanks![/QUOTE] Eclipse can be a pain too, although it is my favorite (and a workplace favorite too). But if it's too complicated, you can try JDeveloper. It might not have as many features though.
[QUOTE=Wealth + Taste;38731697]Yeah I tried Netbeans and it seems really complicated. I don't know if all IDEs are or Netbeans in particular is. I'll try Eclipse. Thanks![/QUOTE] Definitely worth trying out [URL="http://www.jetbrains.com/idea/download/"]IntelliJIDEA[/URL]. Although I use Netbeans nowadays at work for the web development that we do, for my own Java projects these days I use this. I had to use eclipse for some time when I worked with some android development and I never got around to liking it.
[QUOTE=hogofwar;38737632]I have a 25x25 (2d) grid of squares in a multidemensional array (floor[x][y]), I want to do a "wave" of changing the colour of each of them, starting off from a central point, in a sort of circle around the central point. I don't have the problems with changing a colour of them or anything and is such not relevant, but I am having trouble of thinking of a way to implement a roughly circular wave of them changing, while not changing the ones that have already been changed (while having it be reusable an indefinite amount of times).[/QUOTE] Unless you need realistic reflection and such, it's easiest to calculate the value of each point as a function of time. Calculate the offset of the wave based on time and the point's distance from the origin of the wave: [img]http://latex.codecogs.com/gif.latex?\tau%20=%20vt%20-%20\left%20\|%20\overrightarrow{x}%20-%20\overrightarrow{p}%20\right%20\|[/img] (v is the wave propagation speed, t is time, x is the current point and p is the origin of the wave) Calculate the value of the wave e.g. with sin. Depending entirely on how you want to describe the wave. The wave reaches the specific point at tau=0 and passes it with tau>0. [img]http://latex.codecogs.com/gif.latex?F(\tau)%20=%20\begin{cases}%200%20&%20\text{%20if%20}%20\tau%20\leq%200%20\\%20\frac{\sin{\tau}}{\tau}%20&%20\text{%20if%20}%20\tau%20%3E%200%20\end{cases}[/img]
Okay, so now I'm converting from Hex back to the original number where: [code] Numbers are held in 16 bits split from left to right as follows: 1 bit sign flag that should be set for negative numbers and otherwise clear. 7 bit exponent held in Excess 63 8 bit significand, normalised to 1.x with only the fractional part stored – as in IEEE 754 [/code] I have C4E0 and I've ended up with; Sign: 1 (-ve) Exponent: 2^-5 Significand: 1 5/8 (one and five eighths) Now when I normalise the significand back to 2^0 I'm getting 15/256. 1 5/8 * 2^-5 = 0.05078125 15/256 * 2^0 = 0.05859375 Is this difference down to a lack of precision with floats or am I doing something wrong?
0xc4e0 should be sign: 1 exponent: 2^-5 significand: 1 + 7/8 so 15/256 is right
How would I go about writing a custom console window, in order to have more control about it?
Alright so I'm working in c# and I have a list of classes named listProjects anyone know how I would go about checking to see if the string ( Course == "Hello" ) in any of the classes in that list?
Having troubles rotating objects in opengl, more specifcally, rotating them on their centers. I know how to do it, I get it; Set the objects position to half of itself, do the rotation, and set it back. but it just doesn't work for me. Doing so ends up messing up the entire screen and sending all the sprites at positions that are offset what they are supposed to be. I don't know what I am doing wrong. [IMG]https://dl.dropbox.com/u/43867531/rotatingproblem.png[/IMG]
[QUOTE=Duskling;38747337]Having troubles rotating objects in opengl, more specifcally, rotating them on their centers. I know how to do it, I get it; Set the objects position to half of itself, do the rotation, and set it back. but it just doesn't work for me. Doing so ends up messing up the entire screen and sending all the sprites at positions that are offset what they are supposed to be. I don't know what I am doing wrong. [/QUOTE] In order to rotate an object around its origin you need to translate it so that it's origin matches the screens origin, rotate, then translate back to its original position. I believe that's what glPushMatrix and glPopMatrix are for, so you don't have to manually undo all your matrix operations. I'm not entirely sure, I've never spent a lot of time with the depreciated stuff.
[QUOTE=Duskling;38747337]Having troubles rotating objects in opengl, more specifcally, rotating them on their centers. I know how to do it, I get it; Set the objects position to half of itself, do the rotation, and set it back. but it just doesn't work for me. Doing so ends up messing up the entire screen and sending all the sprites at positions that are offset what they are supposed to be. I don't know what I am doing wrong. [IMG]https://dl.dropbox.com/u/43867531/rotatingproblem.png[/IMG][/QUOTE] check: a) what matrix you're working on with glMatrixMode and b) if it works if you load identity after glPushMatrix
I know this isn't the most relevant subject to post about in this section, but I couldn't find any other section or thread on Facepunch that seemed more so, and I didn't feel like going and making an account on some sort of dev website somewhere that I'd never go back to again just to ask. Is compiling stuff in Windows 7 an easy task by any but the farthest of stretches of the imagination? I've downloaded the sources for [url=http://xiph.org/downloads/]libogg, libvorbis[/url], and [url=http://zlib.net/]zlib[/url], had a friend convert libflac.tar.gz to a .zip and send it to me, and have downloaded and installed Microsoft Visual Studio Express 2012 to use to build them, but have been completely unable to get the latter three to build. MVSE was able to build libogg into [I]something,[/I] though I'm not sure the end result is anything useful. The readme said it should compile right out of the box, it reported no errors after it finished building, and there was a libogg.dll, among other things in the Release folder, which looked quite promising, but I have yet to test it. The various Readme files were, for the most part, unhelpful. From them, I gathered that libflac and libvorbis require a compiled copy of libogg, but they seem very unclear about what exactly is supposed to go where exactly. They assume that I already know full well what I'm doing from the start. And no, I don't have any idea what I'm doing. I'm only trying to compile this stuff because I couldn't find any (up-to-date) pre-built DLL's anywhere. I have no experience in compiling or coding/programming, but I am computer literate at least. While I would very much appreciate it if someone were to send me a bunch of pre-built DLL's, I would like to learn how to compile stuff if possible so I can do so in the future should I find any more current sources of dated DLL's or should any of this stuff be updated again. The reason I want these DLL's is so I can use them to replace some games' (most notably Halo's) older DLL's just to see if they notice (and blow up in my face, and die, because in some cases, that's more rewarding than playing the game). :v: Here's some pastes of what the output reads when I try to build zlib, libvorbis, and libflac: [url=http://pastebin.com/TnRasrS8]zlib[/url]; [url=http://pastebin.com/6pem0D0r]libvorbis[/url]; [url=http://pastebin.com/c2bfdURX]libflac[/url] And of course, if this really isn't the place to be asking for help with compiling, I would appreciate being pointed in the right direction. Thanks.
I'm looking for a fast ray-terrain intersection algorithm for XNA. Right now I'm using ray-triangle interesction, but it's too slow with a large number of vertices. The terrain is generated using a height map.
[QUOTE=E-102 Gamma;38750263]I know this isn't the most relevant subject to post about in this section, but I couldn't find any other section or thread on Facepunch that seemed more so, and I didn't feel like going and making an account on some sort of dev website somewhere that I'd never go back to again just to ask. Is compiling stuff in Windows 7 an easy task by any but the farthest of stretches of the imagination? I've downloaded the sources for [url=http://xiph.org/downloads/]libogg, libvorbis[/url], and [url=http://zlib.net/]zlib[/url], had a friend convert libflac.tar.gz to a .zip and send it to me, and have downloaded and installed Microsoft Visual Studio Express 2012 to use to build them, but have been completely unable to get the latter three to build. MVSE was able to build libogg into [I]something,[/I] though I'm not sure the end result is anything useful. The readme said it should compile right out of the box, it reported no errors after it finished building, and there was a libogg.dll, among other things in the Release folder, which looked quite promising, but I have yet to test it. The various Readme files were, for the most part, unhelpful. From them, I gathered that libflac and libvorbis require a compiled copy of libogg, but they seem very unclear about what exactly is supposed to go where exactly. They assume that I already know full well what I'm doing from the start. And no, I don't have any idea what I'm doing. I'm only trying to compile this stuff because I couldn't find any (up-to-date) pre-built DLL's anywhere. I have no experience in compiling or coding/programming, but I am computer literate at least. While I would very much appreciate it if someone were to send me a bunch of pre-built DLL's, I would like to learn how to compile stuff if possible so I can do so in the future should I find any more current sources of dated DLL's or should any of this stuff be updated again. The reason I want these DLL's is so I can use them to replace some games' (most notably Halo's) older DLL's just to see if they notice (and blow up in my face, and die, because in some cases, that's more rewarding than playing the game). :v: Here's some pastes of what the output reads when I try to build zlib, libvorbis, and libflac: [url=http://pastebin.com/TnRasrS8]zlib[/url]; [url=http://pastebin.com/6pem0D0r]libvorbis[/url]; [url=http://pastebin.com/c2bfdURX]libflac[/url] And of course, if this really isn't the place to be asking for help with compiling, I would appreciate being pointed in the right direction. Thanks.[/QUOTE] Yeah compiling on Windows usually isn't as simple as running make. The libraries you mentioned are relatively well-behaving and should compile just fine, as long as all the appropriate files are found and the flags set. The libogg probably produces a libogg.dll and a libogg.lib and some other crap when you build the dynamic linking target. There's probably also a static linking target (possibly an alternative selection in the drop-down menu from which you can usually select Debug and Release?) which produces an ogg_static.lib or a libogg.lib. Building libvorbis requires that the linker finds the libogg.lib. I'm not sure if this refers to the dynamically linked or the statically linked ogg library - likely the former, but either way, you need to copy the libogg.lib you got by building libogg into the library path of VC (dropping it into "VC install directory\VC\lib" ought to do it). Libflac similarly requires ogg_static.lib, which is pretty clearly the statically linked libogg. Just FYI, the difference between static and dynamic linking is that with static linking, the code is contained in the .lib. If vorbis requires static linkage, it basically contains the entire libogg as well, and for programs that only require libvorbis.dll, you don't need libogg.dll. But if libvorbis requires the dynamically linked libogg, the .lib only contains information about where in the libogg.dll it can find the required functionality (the linker will use that information in the .lib while linking libvorbis.dll), and so to run libvorbis.dll you'll need libogg.dll as well.
[QUOTE=ahdge;38748410]In order to rotate an object around its origin you need to translate it so that it's origin matches the screens origin, rotate, then translate back to its original position. I believe that's what glPushMatrix and glPopMatrix are for, so you don't have to manually undo all your matrix operations. I'm not entirely sure, I've never spent a lot of time with the depreciated stuff.[/QUOTE] OH, It's the screen origin? Shiiiieeeeeet. Thanks, I will try that out.
[QUOTE=Tovip;38746523]Alright so I'm working in c# and I have a list of classes named listProjects anyone know how I would go about checking to see if the string ( Course == "Hello" ) in any of the classes in that list?[/QUOTE] Assuming Course is public: [CODE] foreach(classname project in listProjects) { if(project.Course == "Hello") { Console.WriteLine("I found one!"); } } [/CODE] And as "classname" you need the name of the class of which listProjects is a list. So I'm assuming Project or something like that. At least, I think you wanted to check a variable called Course in each class, right? If not, be more specific on the question.
[QUOTE=ThePuska;38750545]Yeah compiling on Windows usually isn't as simple as running make. The libraries you mentioned are relatively well-behaving and should compile just fine, as long as all the appropriate files are found and the flags set. The libogg probably produces a libogg.dll and a libogg.lib and some other crap when you build the dynamic linking target. There's probably also a static linking target (possibly an alternative selection in the drop-down menu from which you can usually select Debug and Release?) which produces an ogg_static.lib or a libogg.lib. Building libvorbis requires that the linker finds the libogg.lib. I'm not sure if this refers to the dynamically linked or the statically linked ogg library - likely the former, but either way, you need to copy the libogg.lib you got by building libogg into the library path of VC (dropping it into "VC install directory\VC\lib" ought to do it). Libflac similarly requires ogg_static.lib, which is pretty clearly the statically linked libogg. Just FYI, the difference between static and dynamic linking is that with static linking, the code is contained in the .lib. If vorbis requires static linkage, it basically contains the entire libogg as well, and for programs that only require libvorbis.dll, you don't need libogg.dll. But if libvorbis requires the dynamically linked libogg, the .lib only contains information about where in the libogg.dll it can find the required functionality (the linker will use that information in the .lib while linking libvorbis.dll), and so to run libvorbis.dll you'll need libogg.dll as well.[/QUOTE] While there isn't an option to build as a static linking target, there is a "libogg_static.sln" solution file in the same folder as the dynamic solution that I am able to build which produces a "libogg_static.lib" among other seemingly useless things. VC as in VisualC? Would this be the correct directory?: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib When I build libogg_static.sln, it doesn't produce a ogg_static. Perhaps libflac is looking for a "ogg_static.lib" because that's what the static library was named in the newest version of libogg available at the time of its release? I tried renaming this "libogg_static" library to "ogg_static," but FLAC still wouldn't build. It seems there are still a whole bunch of other errors that are preventing it from compiling. In this case, I'm after DLL's. Halo has an ogg.dll, a vorbis.dll, and a vorbisfile.dll that I would like to try replacing with newer versions just to see what will happen. Best case scenario, Halo sounds better, since Vorbis is a lossy codec. I'm trying not to get my hopes up too high, though... I just did some testing on Halo and found that if I remove its ogg.dll, it crashes once it gets to the main menu. Same thing happens if I replace its ogg.dll with an empty text document saved as "ogg.dll". If I rename the libogg.dll that I built to ogg.dll and replace Halo's default ogg.dll with it, Halo runs and sounds fine. So Halo does seem to use its ogg.dll, and the libogg.dll I built does seem to be working. By the way, Microsoft Visual Studio Express is freeware, in case you didn't already know. It gives you a 30-day trial before you have to put in some business info, but after that, you can to use it for free indefinitely. It can be downloaded [URL="http://www.microsoft.com/en-us/download/details.aspx?id=34673"]here[/URL] or [URL="http://www.microsoft.com/visualstudio/eng/downloads"]here[/URL].
[QUOTE=E-102 Gamma;38758164] If I rename the libogg.dll that I built to ogg.dll and replace Halo's default ogg.dll with it, Halo runs and sounds fine. So Halo does seem to use its ogg.dll, and the libogg.dll I built does seem to be working. [/QUOTE] Wtf, why do you think they add useless dll files to their game :v:
[QUOTE=Felheart;38758518]Wtf, why do you think they add useless dll files to their game :v:[/QUOTE] I don't. I was just making sure that it does in fact use ogg.dll for science's sake.
Sorry, you need to Log In to post a reply to this thread.