/ comp / gb.opengl / gl / popmatrix
Gl.PopMatrix (gb.opengl)
Syntax

    STATIC SUB PopMatrix ( )

### Pop the current matrix stack

#### Description

There is a stack of matrices for each of the matrix modes. In Gl.GL_MODELVIEW mode, the stack depth is at least 32. In the other two modes, Gl.GL_PROJECTION and Gl.GL_TEXTURE, the depth is at least 2. The current matrix in any mode is the matrix on the top of the stack for that mode.

Gl.PopMatrix pops the current matrix stack, replacing the current matrix with the one below it on the stack. Initially, each of the stacks contains one matrix, an identity matrix.

It is an error to pop a matrix stack that contains only a single matrix. In either case, the error flag is set and no other change is made to GL state.

#### Errors

Gl.GL_STACK_UNDERFLOW is generated if Gl.PopMatrix is called while the current matrix stack contains only a single matrix.
Gl.GL_INVALID_OPERATION is generated if Gl.PopMatrix is called between a call to Gl.Begin and the corresponding call to Gl.End.

#### Associated Gets

Gl.GetMatrixMode
Gl.GetModelviewMatrix
Gl.GetProjectionMatrix
Gl.GetTextureMatrix
Gl.GetModelviewStackDepth
Gl.GetProjectionStackDepth
Gl.GetTextureStackDepth
Gl.GetMaxModelviewStackDepth
Gl.GetMaxProjectionStackDepth
Gl.GetMaxTextureStackDepth

### See also

Gl.PushMatrix , Gl.Frustum, Gl.LoadIdentity, Gl.LoadMatrix, Gl.MatrixMode, Gl.MultMatrix, Gl.Ortho, Gl.Rotate, Gl.Scale, Gl.Translate, Gl.Viewport