Archived

This topic is now archived and is closed to further replies.

BubbleBoy

glRotatef..............

Recommended Posts

my problem is when I try to rotate two cubes. I can get the cubes to draw and to get them to rotate but the second cube rotates around the first ones axis, or so it seems. I draw a cube at 0,0,0 then rotate it, then draw another cube at 2,0,0. they both rotate fine, except the other continues to rotate around the first cubes when I try to make the second one rotate around the y or z axis, anything would be appreciated.....

Share this post


Link to post
Share on other sites
quote:
Original post by Kamil
glLoadIdentity
glPushMatrix
glRotate
DrawCube
glPopMatrix
glTranslatef(2,0,0)
glRotate
DrawCube

This should work

DrawCube at 0,0,0





Homepage.


Or maybe

glLoadIdentity();
glPushMatrix(); // Used to maintain both cubes per frame and group them as one object to inherit properties.
glPushMatrix(); // Draw first cube from here.
glRotate();
DrawCube();
glPopMatrix();
glPushMatrix(); // Draw second cube from here.
glTranslate();
glRotate();
DrawCube();
glPopMatrix();
glPopMatrix();

Maybe my one is the long way round.



Regards,
Mathematix.

[edited by - mathematix on August 12, 2002 11:11:42 PM]

Share this post


Link to post
Share on other sites