GLSTENCILOP(3G)
β¨ NAME β¨
okay so bestie, this is GLSTENCILOP(3G) β literally set stencil test actions. The star of the show is glStencilOp, and she is all about telling OpenGL what to do with your stencil buffer when tests pass or fail. iconic behavior only π
π§Ύ C SPECIFICATION π§Ύ
void glStencilOp( GLenum fail,
GLenum zfail,
GLenum zpass )
π PARAMETERS π
failβ specifies the action to take when the stencil test fails. Six symbolic constants are accepted:GL_KEEP,GL_ZERO,GL_REPLACE,GL_INCR,GL_DECR, andGL_INVERT. The initial value isGL_KEEP. π«Άzfailβ specifies the stencil action when the stencil test passes, but the depth test fails.zfailaccepts the same symbolic constants asfail. The initial value isGL_KEEP. β¨zpassβ specifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled.zpassaccepts the same symbolic constants asfail. The initial value isGL_KEEP. π
πΈ DESCRIPTION πΈ
Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering. literally the moment β¨
The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the value in the stencil buffer and a reference value. To enable and disable the test, call glEnable and glDisable with argument GL_STENCIL_TEST; to control it, call glStencilFunc. okay so that's the vibe check π
glStencilOp takes three arguments that indicate what happens to the stored stencil value while stenciling is enabled. If the stencil test fails, no change is made to the pixel's color or depth buffers, and fail specifies what happens to the stencil buffer contents. The following six actions are possible.
GL_KEEPβ keeps the current value. πGL_ZEROβ sets the stencil buffer value to0. π«§GL_REPLACEβ sets the stencil buffer value toref, as specified byglStencilFunc. πGL_INCRβ increments the current stencil buffer value. Clamps to the maximum representable unsigned value. π₯GL_DECRβ decrements the current stencil buffer value. Clamps to0. π§GL_INVERTβ bitwise inverts the current stencil buffer value. π
Stencil buffer values are treated as unsigned integers. When incremented and decremented, values are clamped to 0 and 2nβ1, where n is the value returned by querying GL_STENCIL_BITS. no cap, that clamp is doing the most π
The other two arguments to glStencilOp specify stencil buffer actions that depend on whether subsequent depth buffer tests succeed (zpass) or fail (zfail) (see glDepthFunc). The actions are specified using the same six symbolic constants as fail. Note that zfail is ignored when there is no depth buffer, or when the depth buffer is not enabled. In these cases, fail and zpass specify stencil action when the stencil test fails and passes, respectively. she said know the difference π¦
π NOTES π
Initially the stencil test is disabled. If there is no stencil buffer, no stencil modification can occur and it is as if the stencil tests always pass, regardless of any call to glStencilOp. bestie, if there's no stencil buffer, she's just pretending everything's fine π
π ERRORS π
GL_INVALID_ENUMis generated iffail,zfail, orzpassis any value other than the six defined constant values. not the six constants? absolutely not, rejected πGL_INVALID_OPERATIONis generated ifglStencilOpis executed between the execution ofglBeginand the corresponding execution ofglEnd. do not do that, the group chat will know π
π ASSOCIATED GETS π
glGetwith argumentGL_STENCIL_FAILglGetwith argumentGL_STENCIL_PASS_DEPTH_PASSglGetwith argumentGL_STENCIL_PASS_DEPTH_FAILglGetwith argumentGL_STENCIL_BITSglIsEnabledwith argumentGL_STENCIL_TEST
π¦ SEE ALSO π¦
glAlphaFunc(3G)glBlendFunc(3G)glDepthFunc(3G)glEnable(3G)glLogicOp(3G)glStencilFunc(3G)
and that's the whole page, bestie β GLSTENCILOP(3G) at the top and GLSTENCILOP(3G) at the bottom, repping the 3G manual the whole way through. mwah πβ¨
π¦ 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