View Full Version : Rotation in openGL
08-05-2005, 06: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?
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?
08-06-2005, 08: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?
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...
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.