GLMATRIXMODE(3G)
π GLMATRIXMODE β bestie, let's talk matrix stacks
okay so this is from the 3G manual (that's the OpenGL girlies' section, iykyk) and it's literally just one function that tells GL which matrix stack you're about to mess with. that's it. that's the whole vibe. she's small but she's important. π
β¨ NAME β¨
glMatrixMode β specify which matrix is the current matrix
like. she picks the current matrix. main character selection screen energy. π
πΈ C SPECIFICATION πΈ
void glMatrixMode( GLenum mode )
that's the whole signature bestie, she takes one arg and returns nothing because she doesn't need to return anything, she's confident π
π¦ PARAMETERS π¦
modeβ Specifies which matrix stack is the target for subsequent matrix operations. Three values are accepted:GL_MODELVIEW,GL_PROJECTION, andGL_TEXTURE. The initial value isGL_MODELVIEW.
Additionally, if the GL_ARB_imaging extension is supported, GL_COLOR is also accepted.
so yeah β three girlies normally, and a fourth one (GL_COLOR) only shows up if GL_ARB_imaging is in the building. and out of the box, before you touch anything, you're already on GL_MODELVIEW. default queen behavior β¨
π 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. π
the way that every single matrix operation after this call goes straight to whichever stack you pickedβ¦ obsessed. it's giving "choose your fighter" but make it linear algebra π
and if you're sitting there like "bestie which stack am I on right now tho" β call glGet with argument GL_MATRIX_MODE. The initial value is GL_MODELVIEW. no cap. π«Ά
π ERRORS π
these are the "not me getting yelled at by the GL" moments. read them. learn them. respect them. π
GL_INVALID_ENUMis generated ifmodeis not an accepted value.GL_INVALID_OPERATIONis generated ifglMatrixModeis executed between the execution ofglBeginand the corresponding execution ofglEnd.
that second one fr fr β do NOT try to switch matrix modes mid-glBegin/glEnd block. GL said "not during". she will literally throw GL_INVALID_OPERATION at you and honestly? valid. π
β ASSOCIATED GETS β
glGetwith argumentGL_MATRIX_MODE
π SEE ALSO π
glLoadMatrix(3G)glPushMatrix(3G)
and that's the whole page bestie π¦ stay stacking, stay hydrated, and remember: GL_MODELVIEW is the default until you say otherwise. periodt. π
this has been your girl from GLMATRIXMODE(3G), out here repping the 3G manual β slay responsibly, and may all your matrix modes be valid ones β¨ππ
π¦ 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