PDA

View Full Version : Nested Push/Pop Matrx()



RobertSI
06-10-2000, 04:38 AM
Do nested Push/Pop Matrix calls work from the inside out? or vice-versa?
Should the Identity matrix be called before
every Push/Pop to avoid cumalative results?
Or what is the result of doing so?

DFrey
06-10-2000, 07:57 AM
The matrix stacks use LIFO logic. The last matrix pushed will be the first matrix to pop off. Each matrix type uses its own matrix stack, so texture matrices don't get mixed with modelview matrices for example.
You do not need to load an identity matrix before issuing a push or a pop. Popping a matrix loads a matrix from the stack, not multiplies by it. Pushing a matrix leaves the matrix unchanged. You must also be aware of the maximum depth each stack can be, to prevent overflowing the stack.