GLMULTMATRIX(3G)
β¨ GLMULTMATRIX β¨
okay bestie, welcome to GLMULTMATRIX(3G) β the 3G manual section, we love her π
πΈ NAME πΈ
glMultMatrixd, glMultMatrixf β multiply the current matrix with the specified matrix π§
π C SPECIFICATION π
void glMultMatrixd( const GLdouble *m )
void glMultMatrixf( const GLfloat *m )
π PARAMETERS π
mβ points to 16 consecutive values that get used as the elements of a 4Γ4 column-major matrix. sixteen!! consecutive!! values!! that's the whole vibe, no cap.
π¦ DESCRIPTION π¦
glMultMatrix multiplies the current matrix by the one you handed it with m, and then replaces the current matrix with the product. so it's not like, a peek, it's a full glow-up β the old matrix is gone, the product is the new main character π
which matrix is "the current matrix" tho? that's decided by the current matrix mode (go check glMatrixMode). it's either the projection matrix, the modelview matrix, or the texture matrix. that's the whole lineup fr fr.
π₯ EXAMPLES π₯
so if the current matrix is C, and the coordinates you're transforming are v=(v[0],v[1],v[2],v[3]), then the current transformation is CΓv, or:
c[0] c[4] c[8] c[12] v[0]
βc[1] c[5] c[9] c[13]β Γβv[1]β
c[2] c[6] c[10] c[14] v[2]
c[3] c[7] c[11] c[15] v[3]
and now the moment you've been waiting for: calling glMultMatrix with an argument of m=m[0],m[1],...,m[15] replaces the current transformation with (CΓM)Γv, or:
c[0] c[4] c[8] c[12] m[0] m[4] m[8] m[12] v[0]
βc[1] c[5] c[9] c[13]β Γβm[1] m[5] m[9] m[13]β Γβv[1]β
c[2] c[6] c[10] c[14] m[2] m[6] m[10] m[14] v[2]
c[3] c[7] c[11] c[15] m[3] m[7] m[11] m[15] v[3]
where 'Γ' denotes matrix multiplication, and v is represented as a 4Γ1 matrix. iconic math behavior honestly π
π NOTES π
- so even tho you can specify the elements of the matrix with single or double precision, the GL might store or operate on those values in less than single precision. not me finding that out the hard way π
- in lots of computer languages, 4Γ4 arrays are represented in row-major order. but the transformations we just described? those represent these matrices in column-major order. don't get it twisted bestie.
- the order of the multiplication is important, and I mean it. like, for example: if the current transformation is a rotation, and
glMultMatrixis 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. different order = different whole situation. periodt.
π€ ERRORS π€
GL_INVALID_OPERATIONis generated ifglMultMatrixis executed between the execution ofglBeginand the corresponding execution ofglEnd. so like, do NOT do that. she will not forgive you π
π ASSOCIATED GETS π
glGetwith argumentGL_MATRIX_MODEglGetwith argumentGL_COLOR_MATRIXglGetwith argumentGL_MODELVIEW_MATRIXglGetwith argumentGL_PROJECTION_MATRIXglGetwith argumentGL_TEXTURE_MATRIX
π SEE ALSO π
glLoadIdentity(3G)glLoadMatrix(3G)glMatrixMode(3G)glPushMatrix(3G)
k bye bestie, go multiply some matrices responsibly πβ¨ that was GLMULTMATRIX(3G) from the 3G manual, mwah π«Άπ
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms