GLCULLFACE(3G)
π 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 constantsGL_FRONT,GL_BACK, orGL_FRONT_AND_BACK. the initial value isGL_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_ENUMis generated ifmodeis not an accepted value. (stick to the three constants, babe. it's not a vibe to freelance here.)GL_INVALID_OPERATIONis generated ifglCullFaceis executed between the execution ofglBeginand the corresponding execution ofglEnd.
β οΈ bestie that second one is a real trap. do not callglCullFaceinside aglBegin/glEndpair. it will not slay. it will error. π
β ASSOCIATED GETS
the little functions you can ask to check on her π
glIsEnabledwith argumentGL_CULL_FACEglGetwith argumentGL_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
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms