PDA

View Full Version : glPushMatrix() and glPopMatrix



zzapatista
02-16-2001, 11:54 AM
I was just wondering if anyone could explain the functions of glPushMatrix() and glPopMatrix? I see them in my book but can't understand what they are there for.

Elixer
02-16-2001, 12:06 PM
Those are used to save/restore the matrix.

They are used for local effects, so instead of having it affect all the objects in the scene, it only affects the current object.

02-19-2001, 01:09 AM
I have also wondered how to handle popmatrix and pushmatrix.

Say that :
When I call popmatrix am I reseting my modelview matrix and then when I call Popmatrix I return to my original modelview matrix ? Or something like that ?

Bob
02-19-2001, 02:45 AM
When you call glPushMatrix, you push a copy of the current matrix to the top of the stack, leaving the current matrix untouched so you can continue to add transformations to it. When you call glPopMatrix, you replace the current matrix with the matrix on the top of the stack.