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

# glMultMatrix

multiply the current matrix with the specified matrix

## Signature

glMultMatrix( )->
glMultMatrixd( const GLdouble * ( m ) )-> void
glMultMatrixd( )
glMultMatrixf( const GLfloat * ( m ) )-> void
glMultMatrixf( )

## Parameters

VariablesDescription
m
Points to 16 consecutive values that are used as the elements of a $44$ column-major matrix.

## Description

glMultMatrix multiplies the current matrix with the one specified using m , and replaces the current matrix with the product.
The current matrix is determined by the current matrix mode (see glMatrixMode ). It is either the projection matrix, modelview matrix, or the texture matrix.

## Examples

If the current matrix is $\mathit{C}$ and the coordinates to be transformed are $\mathit{v}=\left(\mathit{v}\left[0\right],\mathit{v}\left[1\right],\mathit{v}\left[2\right],\mathit{v}\left[3\right]\right)$ , then the current transformation is $\mathit{C}\mathit{v}$ , or
$\left(\begin{array}{cccc}\mathit{c}\left[0\right]& \mathit{c}\left[4\right]& \mathit{c}\left[8\right]& \mathit{c}\left[12\right]\\ \mathit{c}\left[1\right]& \mathit{c}\left[5\right]& \mathit{c}\left[9\right]& \mathit{c}\left[13\right]\\ \mathit{c}\left[2\right]& \mathit{c}\left[6\right]& \mathit{c}\left[10\right]& \mathit{c}\left[14\right]\\ \mathit{c}\left[3\right]& \mathit{c}\left[7\right]& \mathit{c}\left[11\right]& \mathit{c}\left[15\right]\end{array}\right)\left(\begin{array}{c}\mathit{v}\left[0\right]\\ \mathit{v}\left[1\right]\\ \mathit{v}\left[2\right]\\ \mathit{v}\left[3\right]\end{array}\right)$
Calling glMultMatrix with an argument of $\mathit{m}=\left\{\mathit{m}\left[0\right],\mathit{m}\left[1\right],\mathit{...},\mathit{m}\left[15\right]\right\}$ replaces the current transformation with $\left(\mathit{C}\mathit{M}\right)\mathit{v}$ , or
$\left(\begin{array}{cccc}\mathit{c}\left[0\right]& \mathit{c}\left[4\right]& \mathit{c}\left[8\right]& \mathit{c}\left[12\right]\\ \mathit{c}\left[1\right]& \mathit{c}\left[5\right]& \mathit{c}\left[9\right]& \mathit{c}\left[13\right]\\ \mathit{c}\left[2\right]& \mathit{c}\left[6\right]& \mathit{c}\left[10\right]& \mathit{c}\left[14\right]\\ \mathit{c}\left[3\right]& \mathit{c}\left[7\right]& \mathit{c}\left[11\right]& \mathit{c}\left[15\right]\end{array}\right)\left(\begin{array}{cccc}\mathit{m}\left[0\right]& \mathit{m}\left[4\right]& \mathit{m}\left[8\right]& \mathit{m}\left[12\right]\\ \mathit{m}\left[1\right]& \mathit{m}\left[5\right]& \mathit{m}\left[9\right]& \mathit{m}\left[13\right]\\ \mathit{m}\left[2\right]& \mathit{m}\left[6\right]& \mathit{m}\left[10\right]& \mathit{m}\left[14\right]\\ \mathit{m}\left[3\right]& \mathit{m}\left[7\right]& \mathit{m}\left[11\right]& \mathit{m}\left[15\right]\end{array}\right)\left(\begin{array}{c}\mathit{v}\left[0\right]\\ \mathit{v}\left[1\right]\\ \mathit{v}\left[2\right]\\ \mathit{v}\left[3\right]\end{array}\right)$
Where $\mathit{v}$ is represented as a $41$ matrix.

## Notes

While the elements of the matrix may be specified with single or double precision, the GL may store or operate on these values in less-than-single precision.
In many computer languages, $44$ arrays are represented in row-major order. The transformations just described represent these matrices in column-major order. The order of the multiplication is important. For example, if the current transformation is a rotation, and glMultMatrix is called with a translation matrix, the translation is done directly on the coordinates to be transformed, while the rotation is done on the results of that translation.

## Errors

GL_INVALID_OPERATION is generated if glMultMatrix is executed between the execution of glBegin and the corresponding execution of glEnd .

## Associated Gets

glGet with argument GL_MATRIX_MODE
glGet with argument GL_COLOR_MATRIX
glGet with argument GL_MODELVIEW_MATRIX
glGet with argument GL_PROJECTION_MATRIX
glGet with argument GL_TEXTURE_MATRIX

## 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.

glMultMatrixf
OpenGLContext OpenGLContext/scenegraph/nodepath.py Lines: 6, 30
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson48/Lesson48.py Lines: 133, 142
Glinter Core.py Lines: 562
{Artistic License} PymmLib mmLib/OpenGLDriver.py Lines: 250, 261
{LGPL} VisionEgg VisionEgg/Core.py Lines: 887
{LGPL} PyMT examples/apps/3Dviewer/3Dviewer.py Lines: 88, 159
{LGPL} PyMT examples/apps/3Ddrawing/3Ddrawing.py Lines: 114, 136
{LGPL} PyMT pymt/ui/widgets/scatter.py Lines: 18, 447
{LGPL} PyMT pymt/ui/widgets/composed/innerwindow.py Lines: 8, 234
{LGPL} PyMT pymt/graphx/stencil.py Lines: 22, 90
Gloopy gloopy/view/render.py Lines: 132
{GPL3} OpenGL-Programmable 07-attrib.py Lines: 207
{GPL3} OpenGL-Programmable 06-perpixel.py Lines: 196
{GPL3} OpenGL-Programmable 08-pbo.py Lines: 218
{GPL3} OpenGL-Programmable 01-direct.py Lines: 87
{GPL3} OpenGL-Programmable 02-displaylist.py Lines: 92
{GPL3} OpenGL-Programmable 04-vbo.py Lines: 122
{GPL3} OpenGL-Programmable 03-array.py Lines: 103
{GPL3} OpenGL-Programmable 05-shader.py Lines: 188

## MathML Rendering

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