GLSTENCILMASKSEPARAT(3G)

✨ GLSTENCILMASKSEPARAT(3G) β€” stencil mask, but make it separate ✨

okay bestie, welcome to the 3G manual page for glStencilMaskSeparate, and honestly? she's a little niche but she is SO worth knowing πŸŽ€


🌸 NAME 🌸

glStencilMaskSeparate β€” control the front and/or back writing of individual bits in the stencil planes πŸ’…

like, which bits in the stencil planes are even allowed to be written, and for which faces. that's her whole job. periodt.


πŸ¦‹ C SPECIFICATION πŸ¦‹

void glStencilMaskSeparate(GLenum face, GLuint mask);

two args, no drama ✨


πŸ’– PARAMETERS πŸ’–

  • face β€” tells us whether the front stencil writemask, the back stencil writemask, or both get updated. only three symbolic constants are valid here, and they are literally GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK. no cap.
  • mask β€” a bit mask that enables and disables writing of individual bits in the stencil planes πŸ”₯ initially, the mask is all 1's. iconic default behavior.

🧚 DESCRIPTION 🧚

so glStencilMaskSeparate controls the writing of individual bits in the stencil planes. the least significant n bits of mask β€” where n is the number of bits in the stencil buffer β€” specify a mask. where a 1 shows up in the mask, it's possible to write to the corresponding bit in the stencil buffer ✨ where a 0 shows up, that corresponding bit is write-protected 🚫 initially, all bits are enabled for writing.

and here's the fun part: there can be two separate mask writemasks β€” one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives 🫢

glStencilMask() sets both front and back stencil writemasks to the same values, as if glStencilMaskSeparate() were called with face set to GL_FRONT_AND_BACK. so like… the non-separate version is just this one doing both at once, iykyk πŸ’€


😭 ERRORS 😭

  • GL_INVALID_ENUM is generated if face is not one of the accepted tokens. so like, don't be cute and invent a new one πŸ™ˆ

⭐ ASSOCIATED GETS ⭐

glGet() with argument GL_STENCIL_WRITEMASK, GL_STENCIL_BACK_WRITEMASK, or GL_STENCIL_BITS πŸ‘‘


πŸ‘‘ VERSION SUPPORT πŸ‘‘

the original page ships this as a big table with the columns Function / Feature Name down the side and OpenGL Version across the top, and the row for glStencilMaskSeparate has a βœ” in, like, every single one. so bestie: it's supported in 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, and 4.5 πŸ”₯ all of them. every last one. ate and left no crumbs πŸ’…


🌈 SEE ALSO 🌈

  • glColorMask()
  • glDepthMask()
  • glStencilFunc()
  • glStencilFuncSeparate()
  • glStencilMask()
  • glStencilOp()
  • glStencilOpSeparate()

go read those too, they're all in the same friend group 🫢


Copyright Β© 2006 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

Copyright Β© 1991-2006 Silicon Graphics, Inc.


and that's the whole page, bestie 🌸 this came from [FIXME: source], dated 08/09/2021, and yes the header up top said GLSTENCILMASKSEPARAT(3G) β€” go forth and mask your stencil bits separately, you absolute main character πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from