As I read about openGL there are references to the functions glPushMatrix() & glPopMatrix(). I find no explanation of what “the stack” is. A search of this forum for “what is the stack” produced no results. I understand the implementation of a stack in code and the operators push and pop. These two functions appear to operate on “the one and only stack.” I presume to use that phrase as I have yet to recognize any reference to a particular stack.

I have not recognized anything that explains: Why does that stack exist? What is pushed and popped on it? Yes, I can conclude matrices are pushed and popped, but what do those matrices represent?

I presume the matrices represent whatever is being modeled within openGL, but an explanation would inspire much more confidence than my presumptions. Why are they pushed and popped on a stack rather than, say, members of an array of matrices? Are the matrices handled differently according to their position in the stack? When I push a matrix on a stack then start drawing vertices, are those vertices written to the matrix just pushed.

The context I am more accustomed to is: Push something on the stack to save it while I work on something else. When that work is done, pop that item off the stack thereby making it available for use. Is the stack in openGL different from my presumption?

Edit: Maybe this will clarify / simplify my question. An example from another thread, in essence with my comments added:

```
glPushMatrix() //push it from some standard location, really copy it to the top of the stack
glTranslatef( args ) // make some changes
DrawObject ( ONE ) // put the changes on the screen
glPopMatrix() // pop the unchanged matrix off the stack to the standard location
```

Now that changes have been displayed on the screen, the pop operation replaced all the changes with the matrix that was pushed. All the work of the second line of code is gone.