Previous: glMaterial Table of Contents (GL) Next: glMinmax

glMatrixMode

specify which matrix is the current matrix

Deprecation Notice

Note that this function has been marked deprecated in the OpenGL 3.0 specification. You should not be using this function in new code, though it will likely be supported by most implementations via the GL_ARB_compatibility extension. For more information on OpenGL 3.x deprecations, see the deprecations page.

Signature

glMatrixMode( GLenum ( mode ) )-> void
glMatrixMode( mode )
glMatrixMode( GLenum(mode) ) -> None

Parameters

VariablesDescription
mode
Specifies which matrix stack is the target for subsequent matrix operations. Three values are accepted: GL_MODELVIEW , GL_PROJECTION , and GL_TEXTURE . The initial value is GL_MODELVIEW . Additionally, if the
ARB_imaging
extension is supported, GL_COLOR is also accepted.

Description

glMatrixMode sets the current matrix mode. mode can assume one of four values:
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.
GL_COLOR
Applies subsequent matrix operations to the color matrix stack.
To find out which matrix stack is currently the target of all matrix operations, call glGet with argument GL_MATRIX_MODE . The initial value is GL_MODELVIEW .

Errors

GL_INVALID_ENUM is generated if mode is not an accepted value.
GL_INVALID_OPERATION is generated if glMatrixMode is executed between the execution of glBegin and the corresponding execution of glEnd .

Associated Gets

glGet with argument GL_MATRIX_MODE

See Also

Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glMatrixMode
OpenGLContext OpenGLContext/doinchildmatrix.py Lines: 19, 27, 33
OpenGLContext OpenGLContext/framecounter.py Lines: 61, 64
OpenGLContext OpenGLContext/context.py Lines: 539, 661
OpenGLContext OpenGLContext/atlas.py Lines: 253, 255
OpenGLContext OpenGLContext/shadow/shadowcontext.py Lines: 20, 23
OpenGLContext OpenGLContext/scenegraph/texturetransform.py Lines: 44, 56, 59, 66
OpenGLContext OpenGLContext/scenegraph/imagetexture.py Lines: 100, 104
OpenGLContext OpenGLContext/move/viewplatform.py Lines: 137, 139
OpenGLContext OpenGLContext/passes/renderpass.py Lines: 296, 542
OpenGLContext OpenGLContext/passes/flat.py Lines: 235, 237, 248, 250
OpenGLContext OpenGLContext/passes/rendervisitor.py Lines: 255, 319, 321, 398, 416
OpenGLContext OpenGLContext/passes/gl2psrenderpass.py Lines: 23, 25
OpenGLContext tests/gldrawpixelssynth.py Lines: 41, 48, 62, 67
OpenGLContext tests/gldrawpixels.py Lines: 61, 68, 82, 87
OpenGLContext tests/boundingvolume.py Lines: 63, 91
OpenGLContext tests/glutbitmapcharacter.py Lines: 14, 21, 34, 39
OpenGLContext tests/glhistogram.py Lines: 52, 59, 82, 87
OpenGL-Demo PyOpenGL-Demo/da/dots.py Lines: 89
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson26.py Lines: 71, 76, 84, 87
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson11.py Lines: 50, 55, 63, 66
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson18.py Lines: 119, 124, 139, 142
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson45.py Lines: 374, 380
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson19.py Lines: 117, 122, 130, 133
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson41.py Lines: 206, 212
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson16.py Lines: 55, 60, 68, 71
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson4.py Lines: 70, 75, 83, 86
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson42.py Lines: 270, 278, 286, 294, 299, 361, 367
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson2.py Lines: 60, 65, 73, 76
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson12.py Lines: 46, 51, 59, 62
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson13.py Lines: 132, 138
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson23.py Lines: 70, 75, 83, 86
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson5.py Lines: 73, 78, 86, 89
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson3.py Lines: 60, 65, 73, 76
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson1.py Lines: 60, 65, 73, 76
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6.py Lines: 95, 100, 108, 111
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6-multi.py Lines: 129, 134, 142, 145
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson48/NeHeGL.py Lines: 92, 99
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson43/glFreeType.py Lines: 189, 201, 272
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson43/lesson43.py Lines: 87, 93
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson44/glFont.py Lines: 75, 79, 87, 89
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson44/lesson44.py Lines: 215, 222
OpenGL-Demo PyOpenGL-Demo/redbook/hello.py Lines: 87
OpenGL-Demo PyOpenGL-Demo/redbook/drawf.py Lines: 92, 95
OpenGL-Demo PyOpenGL-Demo/redbook/cube.py Lines: 83, 86
OpenGL-Demo PyOpenGL-Demo/redbook/lines.py Lines: 127
OpenGL-Demo PyOpenGL-Demo/redbook/smooth.py Lines: 92, 98
OpenGL-Demo PyOpenGL-Demo/redbook/scene.py Lines: 114, 122
OpenGL-Demo PyOpenGL-Demo/redbook/movelight.py Lines: 118, 121
OpenGL-Demo PyOpenGL-Demo/redbook/fog.py Lines: 122, 128
OpenGL-Demo PyOpenGL-Demo/redbook/teapots.py Lines: 182, 188
OpenGL-Demo PyOpenGL-Demo/redbook/double.py Lines: 95, 98
OpenGL-Demo PyOpenGL-Demo/GLE/maintest.py Lines: 57, 60
OpenGL-Demo PyOpenGL-Demo/GLUT/glutplane.py Lines: 240, 242
OpenGL-Demo PyOpenGL-Demo/GLUT/shader_test.py Lines: 31, 36, 73, 76
OpenGL-Demo PyOpenGL-Demo/GLUT/gears.py Lines: 207, 210
OpenGL-Demo PyOpenGL-Demo/GLUT/molehill.py Lines: 133, 135
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/cone.py Lines: 62, 73
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/lorentz.py Lines: 70, 79
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/checker.py Lines: 63, 74
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/text.py Lines: 53, 64
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/arraytest.py Lines: 64, 69
OpenGL-Demo PyOpenGL-Demo/proesch/stereo/stereoDemo.py Lines: 62, 65
OpenGL-Demo PyOpenGL-Demo/proesch/bezier/bezier.py Lines: 87, 91
OpenGL-Demo PyOpenGL-Demo/proesch/nurbs/nurbs.py Lines: 140, 144
Glinter Widget.py Lines: 54, 57, 101, 584, 588, 592, 597, 663, 669, 673, 674
{Artistic License} PymmLib applications/glutviewer.py Lines: 163, 175
{Artistic License} PymmLib mmLib/OpenGLDriver.py Lines: 138, 150
pyBzEdit pyBzEdit.py Lines: 419, 425, 761, 777, 808, 810
{LGPL} PyUI tests/testcube.py Lines: 45
{LGPL} PyUI pyui/renderers/openglBase.py Lines: 307, 312, 326, 328, 331, 343
{LGPL} PyUI pyui/renderers/openglGlut.py Lines: 230, 233
{LGPL} PyUI pyui/renderers/openglPygame.py Lines: 181, 185, 193, 195
{LGPL} PyUI2 renderers/openglBase.py Lines: 307, 312, 326, 328, 331, 343
{LGPL} PyUI2 renderers/openglGlut.py Lines: 230, 233
{LGPL} PyUI2 renderers/openglPygame.py Lines: 184, 188, 196, 198
{LGPL} PyUI2 system/glutdevice.py Lines: 171, 174
{LGPL} PyUI2 system/openglgraphics.py Lines: 185, 190, 204, 206, 209, 212
{LGPL} VisionEgg test/conform.py Lines: 156, 215
{LGPL} VisionEgg VisionEgg/Gratings.py Lines: 328
{LGPL} VisionEgg VisionEgg/Core.py Lines: 554, 789, 794, 799, 804, 810, 823, 836, 873, 1073
{LGPL} VisionEgg VisionEgg/SphereMap.py Lines: 251, 528, 834, 1070, 1209
{LGPL} VisionEgg VisionEgg/MoreStimuli.py Lines: 111, 311
{LGPL} VisionEgg VisionEgg/Text.py Lines: 256, 320
{LGPL} VisionEgg VisionEgg/Dots.py Lines: 238
{LGPL} VisionEgg VisionEgg/Textures.py Lines: 1447, 1782, 1906
{GPL} GLChess src/lib/scene/opengl/opengl.py Lines: 359, 367, 425, 430, 454, 553, 564
{LGPL} Pyggel pyggel/view.py Lines: 280, 285, 299, 303
{LGPL} Pyggel pyggel/data.py Lines: 548, 552, 610, 614
{LGPL} pygl2d pygl2d/window.py Lines: 69, 73, 78, 80
{GPL} Scocca scocca/graphics/opengl/matrix.py Lines: 29
{LGPL or GPL or MPL} Kamaelia Sketches/THF/simplecube/simplecube_controlled.py Lines: 73, 77
{LGPL or GPL or MPL} Kamaelia Sketches/THF/simplecube/simplecube.py Lines: 21, 25
{LGPL or GPL or MPL} Kamaelia Sketches/THF/Packages/Kamaelia/Community/THF/Kamaelia/UI/OpenGL/OpenGLDisplay.py Lines: 478, 753, 769, 778, 789, 859
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Progress3D.py Lines: 136
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/SimpleCube.py Lines: 135
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/PygameWrapperPlane.py Lines: 141
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Button3D.py Lines: 177
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Object3D.py Lines: 119
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/TexPlane.py Lines: 133
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Display3D.py Lines: 145
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Scrollbar3D.py Lines: 161
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/playground/Display3D.py Lines: 150, 411, 455, 463, 474
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Kamaelia/UI/OpenGL/OpenGLDisplay.py Lines: 478, 754, 770, 779, 790, 860
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Examples/simplecube/simplecube.py Lines: 21, 25
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/Progress3D.py Lines: 136
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/SimpleCube.py Lines: 135
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/PygameWrapperPlane.py Lines: 141
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/Button3D.py Lines: 177
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/Object3D.py Lines: 119
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/TexPlane.py Lines: 133
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/Display3D.py Lines: 145
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/Scrollbar3D.py Lines: 161
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/playground/Display3D.py Lines: 150, 411, 455, 463, 474
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Utils/Particles3D.py Lines: 248, 289, 313, 317, 332, 334, 337
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Utils/TopologyViewer3D.py Lines: 639
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Cubes.py Lines: 36, 43, 298, 308, 316, 319
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Spheres.py Lines: 20, 23
{LGPL or GPL or MPL} Kamaelia Sketches/MPS/Old/SoC/simplecube.py Lines: 49, 53
{LGPL or GPL or MPL} Kamaelia Code/Python/Kamaelia/Kamaelia/UI/OpenGL/OpenGLDisplay.py Lines: 478, 753, 769, 778, 789, 859
Previous: glMaterial Table of Contents (GL) Next: glMinmax