PDA

View Full Version : rotate object?



phenius
04-27-2001, 03:34 PM
Hi I'm a newbie and I'm trying to rotate an object independent of the viewing camera. What function do I use? I know how to use gluLookAt() to move the camera already, but want to move just the object.

Thanks in advance!

-Ian

04-27-2001, 06:46 PM
do something like this:

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glRotated(degrees, x, y, z);
//draw stuff you want rotated here
glPopMatrix();

glPushMatrix() will store the current state so you don't rotate stuff you have already drawn

in glRotated() degrees is the amount of rotation, and set x,y,and z to a non-zero number in order to rotate along that axis

then use glPopMatrix() to bring back the stuff from before

there are some fine points to this but just practice with it a little

04-27-2001, 06:48 PM
oh remember this....

in relation to your monitor:
x is left right
y is up down
z is in out