/ comp / gb.opengl / gl / pushmatrix
Gl.PushMatrix (gb.opengl)
Syntax

    STATIC SUB PushMatrix ( )

### Push 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.PushMatrix pushes the current matrix stack down by one, duplicating the current matrix. That is, after a Gl.PushMatrix call, the matrix on the top of the stack is identical to the one below it.

It is an error to push a full matrix stack. In either case, the error flag is set and no other change is made to GL state.

#### Errors

Gl.GL_STACK_OVERFLOW is generated if Gl.PushMatrix is called while the current matrix stack is full.
Gl.GL_INVALID_OPERATION is generated if Gl.PushMatrix 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.MaxModelviewStackDepth
Gl.MaxProjectionStackDepth
Gl.MaxTextureStackDepth

### See also

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