Jump to content
  • Advertisement

Archived

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

BubbleBoy

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

This topic is 5908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
glLoadIdentity
glPushMatrix
glRotate
DrawCube
glPopMatrix
glTranslatef(2,0,0)
glRotate
DrawCube

This should work

DrawCube at 0,0,0





Homepage.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!