PDA

View Full Version : Rotation in openGL



ThunderSoul
08-05-2005, 05:27 PM
I would like to rotate a scene upwards and downwards; not rotate by an axis, but simply rotate up and down. I've read the Red Book about specifying azimut/elevation, and translation, but I seem to be failing.
Could anyone point me in the right direction or display some sample code that could get me started, please?
Thank you...

Hlz
08-05-2005, 05:37 PM
I would like to rotate a scene upwards and downwards; not rotate by an axis, but simply rotate up and down.What do you mean by this?

ThunderSoul
08-06-2005, 07:27 AM
What I meant is, rotate the camera upwards/downwards, or around an "arbitrary" axis.
For example, if I have a cube of volume 8 centered at the origin, and my camera is positioned at 3,3,3, how would I rotate the camera so that it will be above the cube? I believe I have to make some calls to glRotate*(...) and one call to glTranslate*(...). I was, however, unable to succeed.
What shoul I do?

Thank you...

Hlz
08-07-2005, 12:27 AM
Spend some time in a matrix algebra book, look for matrix tutorials, search this board (I'm sure this question or one like it has come up before). The opengl commands glRotate and glTranslate do nothing more than create a composite matrix for you, by concatenating individual rotation and translation matrices. Understand these matrices and you'll understand transformations in opengl. If you don't understand the math, you'll be agonizing over each new scenario...