How do you rotate two objects independently? I have a 3d cube suspended above a floor. i want to rotate the cube and not the floor. I can’t get all the pushMatrix popmatrix, Modelview stuff to work right… Can someone tell me the the syntax for acheiving this effect? Thanks again!
//preparation before rendering
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//Set the view frustum(glfrustum or gluProjections
glMatrixMode(GL_MODELVIEW);
glLoadIdentity()
//Set the camera position
glPushMatrix();
//transformations
//Draw the floor
glPopMatrix();
glPushMatrix();
//transformations
// draw cube
glPopMatrix();
don’t forget, if you want to rotate and oject around it’s center you need to put the glRotate before the glTranslate
[This message has been edited by Gorg (edited 04-04-2000).]
Originally posted by Gorg:
[b]//preparation before rendering
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//Set the view frustum(glfrustum or gluProjections
glMatrixMode(GL_MODELVIEW);
glLoadIdentity()
I’m not sure I understand. What does translation have to do with my rotation?
//Set the camera position
glPushMatrix();
//transformations
//Draw the floor
glPopMatrix();
glPushMatrix();
//transformations
// draw cube
glPopMatrix();
don’t forget, if you want to rotate and oject around it’s center you need to put the glRotate before the glTranslate
[This message has been edited by Gorg (edited 04-04-2000).][/b]
If you don’t need to use translations, then don’t use them.