PDA

View Full Version : storing transformations and rotations



Spaceaholic
06-18-2011, 09:13 AM
I am working with java and opengl lite and I want to create a world containing buildings and movable charaters. right now I have characters and buildings drawn to the screen but they are stationary as there transforms are hard coded into the draw function... what is the most popular and efficient way of storing the positioning data elsewhere so I can manipulate it?

Ilian Dinev
06-18-2011, 09:25 AM
a 4x3 matrix. 3x3 for rotation, 1x3 for translation.
There are also euler angles, and quaternions.

coffeeaddict
06-18-2011, 10:08 AM
GLFrame has been useful for storing the position and orientation of the geometry in the scene. You apply transformations to the GLFrame object using the methods in GLFrame, then use a get method to retrieve a 4x4 matrix. Multiply that matrix by the modelview matrix and you're ready to draw. The GLFrame class comes with the GL Super Bible CD but it has been blasted all over the internet so you should be able to get the header file.

Spaceaholic
06-18-2011, 10:19 AM
Thanks for the response, and this may sound like a stupid question, but does java have a built in matrix class I should be using or do I have to implement my own?

coffeeaddict
06-18-2011, 11:08 AM
My apologies. I read your post but didn't absorb the Java part for some reason. I'll be more careful next time. You may have to port from C++ if you want to use it. Sorry again...