View Full Version : glPushMatrix() and glPopMatrix
02-16-2001, 10: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.
02-16-2001, 11:06 AM
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.
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 ?
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.