   glPushMatrix() question
  When using glPushMatrix() with multiple objects does that push a new coordinate space for that object on the stack? I ask this because I have a bunsh of objects on screen and they seem to be layered on top of each other. Also, how could I fix not having them drawn in a layered fashion but still push and pop matrices?Thanks a lot. 
  it s not clear what you mean... for me...If you Push your Matrix you save the current Matrix. Then you can translate, rotatef what ever and THEN-> You pop (load) your old Matrix. And the transformations, rotations whatever are not there for all the Object you draw after popping you old MatrixDunno if pop / push saves / loads the matrix  I forget it alwaysMFG ;quote:Original post by jon723  When using glPushMatrix() with multiple objects does that push a new coordinate space for that object on the stack? I ask this because I have a bunsh of objects on screen and they seem to be layered on top of each other. Also, how could I fix not having them drawn in a layered fashion but still push and pop matrices?Thanks a lot.   I think you''re probably doing something wrong with your depth testing if they appear "layered".  I''m not entirely sure what you''re talking about, though.   ;quote:Original post by jon723  When using glPushMatrix() with multiple objects does that push a new coordinate space for that object on the stack? I ask this because I have a bunsh of objects on screen and they seem to be layered on top of each other. Also, how could I fix not having them drawn in a layered fashion but still push and pop matrices?glPushMatrix makes a copy of the current modelview matrix (coordinate space if you like) on the top of the stack. You can remove it from the stack and make it current again with glPopMatrix. The rest of your question makes no sense, so I can''t help you with it.  ;  I just want to add a practical example, in case you don''t understand yet: Lets say you''re about to draw something: a box. You want to draw this box at coordinates (10, 10, -5). But after that you want to draw something else as well, at coordinates (-10, 0, 0).without push/pop matrix, you''d have to do this: gltranslatef( 10,  10, -5) //draw the object glBegin()etc...glEnd() //draw the other oneglTranslatef( -20, -10, 5) //make up for the last translationglBegin()etc...glEnd() That''s a pain though, because I''d have to keep track of where I last translated to. PushMatrix() / PopMatrix effectively does that for you.//draw first oneglPushMatrix()//save a copy of modelview matrixglTranslatef(10, 10, -5);// translate to the object''s coordinatesglBegin()etc...glEnd() glPopMatrix(); //load the last matrix saved//draw second oneglPushMatrix()//save a copy of modelview matrixglTranslatef(-10, 0, 0);// translate to the object''s coordinatesglBegin()etc...glEnd() glPopMatrixyou can even do rotations and scaling inside a push/pop block. It will only affect vertices drawn after and up to the next popMatrix call.