GLCULLFACE(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

πŸ’… GLCULLFACE (3G) β€” the culling one, bestie

okay so real quick: this is glCullFace, page GLCULLFACE(3G) from the 3G manual set. she's an OpenGL baddie and she decides which side of your 3D shape gets yeeted before it ever touches your screen. let's get into it ✨


πŸ“œ C SPECIFICATION

void glCullFace( GLenum mode )

that's it. that's the whole signature. one arg, so much power. 🫢


πŸŽ€ PARAMETERS

  • mode β€” tells the universe which facets are candidates for culling (aka which ones are gonna get ghosted πŸ‘»). you feed her one of the symbolic constants GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK. the initial value is GL_BACK, so back faces are already on the chopping block by default. periodt.

🌸 DESCRIPTION

so glCullFace specifies whether front- or back-facing facets get culled (as specified by mode) when facet culling is enabled. key phrase: when it's enabled β€” because facet culling is initially disabled, bestie. nothing is being culled out of the box. you have to opt in πŸ’…

to enable and disable facet culling, you call glEnable and glDisable with the argument GL_CULL_FACE. that's the switch. flip it. πŸ•ΉοΈ

and what even counts as a facet? glad you asked: facets include triangles, quadrilaterals, polygons, and rectangles. shapes! geometry! the whole buffet. πŸ”₯

meanwhile glFrontFace specifies which of the clockwise and counterclockwise facets are front-facing and back-facing, so if you're confused about which side is the front, that's a glFrontFace problem, not a glCullFace problem. see glFrontFace. πŸ‘€


πŸ¦‹ NOTES

if mode is GL_FRONT_AND_BACK, no facets are drawn… but other primitives such as points and lines are still drawn. so like, the shapes dip out but the dots and lines stay at the party. πŸ’€


πŸ’œ ERRORS

  • GL_INVALID_ENUM is generated if mode is not an accepted value. (stick to the three constants, babe. it's not a vibe to freelance here.)
  • GL_INVALID_OPERATION is generated if glCullFace is executed between the execution of glBegin and the corresponding execution of glEnd.
⚠️ bestie that second one is a real trap. do not call glCullFace inside a glBegin/glEnd pair. it will not slay. it will error. 😭

⭐ ASSOCIATED GETS

the little functions you can ask to check on her πŸ‘‘

  • glIsEnabled with argument GL_CULL_FACE
  • glGet with argument GL_CULL_FACE_MODE

🌈 SEE ALSO

  • glEnable(3G)
  • glFrontFace(3G)

mkay that's the whole page!! go forth and cull responsibly, my love. half your triangles are invisible anyway β€” might as well not pay for 'em πŸ’–

sign-off szn: you just read GLCULLFACE(3G), and the footer is literally just GLCULLFACE(3G) again β€” same title, same manual, bookending this whole thing like a matching set. iconique. πŸŽ€βœ¨

πŸ“¦ where this page comes from