Lets say i have a scene with four cubes. How do I say rotate/translate only two of these cubes in OpenGL without changing the others using glrotatef anf gltranslate? I dont wanna define my own homogeneous co-ordinates.
Asked
Active
Viewed 3,637 times
1 Answers
5
- You draw your first two cubes as usual
- Push the view-model matrix (
glPushMatrix(GL_MODELVIEW_MATRIX)
) - Call glRotate/glTranslate to setup the rotation of the two cubes which you want to draw in a different way
- Draw the other two cubes
- Pop the original view-model matrix (
glPopMatrix(GL_MODELVIEW_MATRIX)
)

Meh
- 7,016
- 10
- 53
- 76
-
1Agreed, except that glPushMatrix and glPopMatrix don't take a parameter. They work on whichever matrix stack is current (based on glMatrixMode). – Incredulous Monk May 21 '10 at 04:13