glPushMatrix & glPopMatrix

In lame man's term, what do these exactly do. I kinda finding it hard to imagine at the moment despite seeing this in a lot of code.
1
2
3
4
5
6
7
8
9
10
11
12
13
glMatrixMult(some_matrix);

glPushMatrix();

glMatrixMultf(some_other_matrix);

//draw a shape.
//this shape will be transformed by both some_matrix and some_other_matrix.

glPopMatrix();

//draw another shape.
//it will only be transformed by some_matrix. 


OpenGL has a matrix stack. glPushMatrix pushes the copy of the top matrix onto the stack. glPopMatrix pops the top. glTranslatef, glRotatef, glScalef and glMatrixMultf multiply the top of the stack by some other matrix (thus combining their effects).
Topic archived. No new replies allowed.