glMatrixMode

specify which matrix is the current matrix

Signature

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

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/atlas.py Lines: 253, 255
OpenGLContext OpenGLContext/scenegraph/texturetransform.py Lines: 44, 56, 59, 66
OpenGLContext OpenGLContext/scenegraph/imagetexture.py Lines: 101, 105
OpenGLContext OpenGLContext/move/viewplatform.py Lines: 137, 141
OpenGLContext OpenGLContext/shadow/shadowcontext.py Lines: 20, 23
OpenGLContext OpenGLContext/passes/flatcompat.py Lines: 60, 70, 74, 153, 256
OpenGLContext OpenGLContext/passes/flatcore.py Lines: 241
OpenGLContext OpenGLContext/passes/_flat.py Lines: 519
OpenGLContext OpenGLContext/passes/renderpass.py Lines: 296, 541
OpenGLContext OpenGLContext/passes/rendervisitor.py Lines: 252, 316, 318, 395, 413
OpenGLContext tests/shadow_1.py Lines: 289, 393, 395
OpenGLContext tests/glhistogram.py Lines: 50, 57, 80, 85
OpenGLContext tests/gldrawpixelssynth.py Lines: 44, 51, 65, 70
OpenGLContext tests/boundingvolume.py Lines: 71, 73, 101
OpenGLContext tests/glutbitmapcharacter.py Lines: 12, 19, 32, 37
OpenGLContext tests/gldrawpixels.py Lines: 64, 71, 85, 90
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson11.py Lines: 53, 58, 66, 69
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson18.py Lines: 116, 121, 136, 139
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6.py Lines: 92, 97, 105, 108
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson41.py Lines: 209, 215
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson16.py Lines: 57, 62, 70, 73
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson23.py Lines: 72, 77, 85, 88
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson5.py Lines: 70, 75, 83, 86
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson4.py Lines: 67, 72, 80, 83
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson26.py Lines: 73, 78, 86, 89
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson12.py Lines: 49, 54, 62, 65
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson3.py Lines: 57, 62, 70, 73
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson13.py Lines: 129, 135
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson1.py Lines: 57, 62, 70, 73
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson19.py Lines: 121, 126, 134, 137
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson42.py Lines: 266, 274, 282, 290, 295, 357, 363
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson2.py Lines: 57, 62, 70, 73
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6-multi.py Lines: 127, 132, 140, 143
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson45.py Lines: 359, 365
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/NeHe/lesson43/lesson43.py Lines: 87, 93
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson43/glFreeType.py Lines: 189, 201, 272
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson48/NeHeGL.py Lines: 92, 99
OpenGL-Demo PyOpenGL-Demo/proesch/stereo/stereoDemo.py Lines: 64, 67
OpenGL-Demo PyOpenGL-Demo/proesch/bezier/bezier.py Lines: 90, 94
OpenGL-Demo PyOpenGL-Demo/proesch/nurbs/nurbs.py Lines: 143, 147
OpenGL-Demo PyOpenGL-Demo/da/dots.py Lines: 88
OpenGL-Demo PyOpenGL-Demo/GLE/maintest.py Lines: 51, 54
OpenGL-Demo PyOpenGL-Demo/GLUT/gears.py Lines: 212, 215
OpenGL-Demo PyOpenGL-Demo/GLUT/shader_test.py Lines: 31, 36, 73, 76
OpenGL-Demo PyOpenGL-Demo/GLUT/glutplane.py Lines: 242, 244
OpenGL-Demo PyOpenGL-Demo/GLUT/molehill.py Lines: 132, 134
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/checker.py Lines: 60, 71
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/lorentz.py Lines: 70, 79
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/arraytest.py Lines: 60, 65
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/text.py Lines: 53, 64
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/cone.py Lines: 62, 73
OpenGL-Demo PyOpenGL-Demo/redbook/hello.py Lines: 84
OpenGL-Demo PyOpenGL-Demo/redbook/scene.py Lines: 111, 119
OpenGL-Demo PyOpenGL-Demo/redbook/drawf.py Lines: 91, 94
OpenGL-Demo PyOpenGL-Demo/redbook/lines.py Lines: 125
OpenGL-Demo PyOpenGL-Demo/redbook/movelight.py Lines: 115, 118
OpenGL-Demo PyOpenGL-Demo/redbook/smooth.py Lines: 86, 92
OpenGL-Demo PyOpenGL-Demo/redbook/fog.py Lines: 116, 122
OpenGL-Demo PyOpenGL-Demo/redbook/double.py Lines: 88, 91
OpenGL-Demo PyOpenGL-Demo/redbook/teapots.py Lines: 184, 190
OpenGL-Demo PyOpenGL-Demo/redbook/cube.py Lines: 80, 83
OpenGL-Demo py2exe-example/shader_test.py Lines: 32, 37, 74, 77
{Artistic License} PymmLib pymmlib/applications/glutviewer.py Lines: 163, 175
{Artistic License} PymmLib pymmlib/mmLib/OpenGLDriver.py Lines: 145, 157
{LGPL} PyUI2 renderers/openglGlut.py Lines: 230, 233
{LGPL} PyUI2 renderers/openglBase.py Lines: 307, 312, 326, 328, 331, 343
{LGPL} PyUI2 renderers/openglPygame.py Lines: 184, 188, 196, 198
{LGPL} PyUI2 system/openglgraphics.py Lines: 185, 190, 204, 206, 209, 212
{LGPL} PyUI2 system/glutdevice.py Lines: 171, 174
{LGPL} VisionEgg VisionEgg/MoreStimuli.py Lines: 111, 315
{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/Dots.py Lines: 241, 365
{LGPL} VisionEgg VisionEgg/Gratings.py Lines: 328
{LGPL} VisionEgg VisionEgg/Textures.py Lines: 1447, 1782, 1906
{LGPL} VisionEgg VisionEgg/Text.py Lines: 414, 478
{LGPL} VisionEgg test/conform.py Lines: 156, 215
{LGPL} PyMT examples/apps/3Ddrawing/3Ddrawing.py Lines: 36, 41, 48, 50, 52, 100, 108
{LGPL} PyMT examples/apps/3Dviewer/3Dviewer.py Lines: 45, 50, 57, 59, 61, 81, 153
{LGPL} PyMT pymt/ui/window/__init__.py Lines: 19, 454, 466
{LGPL} PyMT pymt/graphx/statement.py Lines: 54, 175, 181
{LGPL} Pyggel pyggel/view.py Lines: 280, 285, 299, 303
{LGPL} Pyggel pyggel/data.py Lines: 548, 552, 610, 614
{LGPL} pygl2d pygl2d/display.py Lines: 57, 61, 66, 68
{GPL} Scocca scocca/graphics/opengl/matrix.py Lines: 29
{LGPL or GPL or MPL} Kamaelia Code/Python/Kamaelia/Kamaelia/Visualisation/PhysicsGraph3D/Particles3D.py Lines: 544, 590, 619, 623, 636, 638, 641
{LGPL or GPL or MPL} Kamaelia Code/Python/Kamaelia/Kamaelia/UI/OpenGL/OpenGLDisplay.py Lines: 479, 771, 787, 801, 812, 882
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Utils/Particles3D.py Lines: 284, 325, 349, 353, 368, 370, 373
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Utils/TopologyViewer3D.py Lines: 660
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Cubes.py Lines: 55, 62, 317, 327, 335, 338
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Spheres.py Lines: 39, 42
{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: 38, 42
{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/Button3D.py Lines: 177
{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/Progress3D.py Lines: 136
{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/Object3D.py Lines: 119
{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/playground/Display3D.py Lines: 150, 411, 455, 463, 474
{LGPL or GPL or MPL} Kamaelia Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Visualisation/PhysicsGraph3D/Particles3D.py Lines: 544, 590, 619, 623, 636, 638, 641
{LGPL or GPL or MPL} Kamaelia Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/UI/OpenGL/OpenGLDisplay.py Lines: 479, 771, 787, 801, 812, 882
{LGPL or GPL or MPL} Kamaelia Sketches/MPS/Old/SoC/simplecube.py Lines: 67, 71
{LGPL or GPL or MPL} Kamaelia Sketches/THF/simplecube/simplecube_controlled.py Lines: 90, 94
{LGPL or GPL or MPL} Kamaelia Sketches/THF/simplecube/simplecube.py Lines: 38, 42
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Scrollbar3D.py Lines: 161
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Button3D.py Lines: 177
{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/Progress3D.py Lines: 136
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/TexPlane.py Lines: 133
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Object3D.py Lines: 119
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Display3D.py Lines: 145
{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/THF/Packages/Kamaelia/Community/THF/Kamaelia/UI/OpenGL/OpenGLDisplay.py Lines: 478, 753, 769, 778, 789, 859
Gloopy gloopy/view/modelview.py Lines: 24, 32
Gloopy gloopy/view/projection.py Lines: 39, 65, 75
Visvis core/cameras.py Lines: 681, 692, 1138, 1156, 1756, 1771
Visvis core/axes.py Lines: 802, 805, 894, 897, 921, 924, 937, 940, 960, 963, 1027, 1035
Visvis core/baseFigure.py Lines: 910, 913
{GPL3} OpenGL-Programmable 05-shader.py Lines: 125, 184, 214, 225
{GPL3} OpenGL-Programmable 07-attrib.py Lines: 142, 203, 233, 244
{GPL3} OpenGL-Programmable 03-array.py Lines: 58, 99, 129, 140
{GPL3} OpenGL-Programmable 06-perpixel.py Lines: 133, 192, 222, 233
{GPL3} OpenGL-Programmable 02-displaylist.py Lines: 58, 88, 127, 138
{GPL3} OpenGL-Programmable 04-vbo.py Lines: 59, 118, 148, 159
{GPL3} OpenGL-Programmable 01-direct.py Lines: 58, 83, 118, 129
{GPL3} OpenGL-Programmable 08-pbo.py Lines: 153, 214, 255, 266