PDA

View Full Version : rotating........



spaceleader
07-25-2001, 09:23 AM
ok i'm very new to OpenGL just got everything working /linking/ and stuff which took me two days to get! now i juade made this human with spheres and cubes, it looks pretty cool but the think is i want to be able to rotate the guy and see is back and is side........i know about the glRotatef function but not quite sure how to use it....can someone shed a little light on this please.....thank you

V--man
07-25-2001, 10:11 AM
You call glRotate just before rendering your object and you do that to the modelview matrix.
If you're new, post to the beginners group. Besides, there are tons of demoes out there such as at the ati and nvidia site.

V-man

V--man
07-25-2001, 10:18 AM
woops, this is the beginners forum!

Morglum
07-26-2001, 04:39 AM
glRotatef makes a rotation around an axis. You have to specify the angle of rotation, together with the (x,y,z)-coordinates of a vector lying on this axis. The call looks like :
glRotatef (angle_in_degrees, axis_x, axis_y, axis_z);
for example, you could write glRotatef (180, 0, 1, 0); if you want to make an half turn around the y-axis.

P.S.: you have to call glRotatef BEFORE drawing your model. Your display function should look like

glClear(...);
glLoadIdentity (); //cancels old calls to glRotatef
glRotatef(...);
DrawMyModel ();
glutSwapBuffers (); //if you're using glut
I hope that this will help.

[This message has been edited by Morglum (edited 07-26-2001).]