GLMATRIXMODE(3G)

πŸ“¦ version 1.1, in centos-stream 9, fedora 43, fedora 44

πŸ’… 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, and GL_TEXTURE. The initial value is GL_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_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.

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 ⭐

  • glGet with argument GL_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