The glMatrixMode function specifies which matrix is the current matrix.

void glMatrixMode(
  GLenum mode


The matrix stack that is the target for subsequent matrix operations. The mode parameter can assume one of three values:
Value Meaning
GL_MODELVIEW Applies subsequent matrix operations to the modelview matrix stack.
GL_PROJECTION Applies subsequent matrix operations to the projection matrix stack.
GL_TEXTURE Applies subsequent matrix operations to the texture matrix stack.


The glMatrixMode function sets the current matrix mode.

The following function retrieves information related to glMatrixMode:

glGet with argument GL_MATRIX_MODE

Error Codes

The following are the error codes generated and their conditions.

Error code Condition
GL_INVALID_ENUM mode was not an accepted value.
GL_INVALID_OPERATION glMatrixMode was called between a call to glBegin and the corresponding call to glEnd.


  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Gl.h.
  Library: Use Opengl32.lib.

See Also

glBegin, glEnd, glLoadMatrix, glPushMatrix


Community Additions