GLSTENCILFUNCSEPARAT(3G)

    .SH "NAME" glStencilFuncSeparate - set front and/or back function and reference value for stencil testing
    .SH "C SPECIFICATION"

            .HP u void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);

    .SH "PARAMETERS"

        .PP face

                    Specifies whether front and/or back stencil state is updated. Three symbolic constants are valid: GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK.

            .RE
            .PP func

                        Specifies the test function. Eight symbolic constants are valid: GL_NEVER, GL_LESS, GL_LEQUAL, GL_GREATER, GL_GEQUAL, GL_EQUAL, GL_NOTEQUAL, and GL_ALWAYS. The initial value is GL_ALWAYS.

                .RE
                .PP ref

                            Specifies the reference value for the stencil test. ref is clamped to the range 0 2 n - 1, where n is the number of bitplanes in the stencil buffer. The initial value is 0.

                    .RE
                    .PP mask

                                Specifies a mask that is ANDed with both the reference value and the stored stencil value when the test is done. The initial value is all 1's.

                        .RE

                    .SH "DESCRIPTION"
                        .PP 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.
                        .PP The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the reference value and the value in the stencil buffer. To enable and disable the test, call glEnable() and glDisable with argument GL_STENCIL_TEST. To specify actions based on the outcome of the stencil test, call glStencilOp() or glStencilOpSeparate().
                        .PP There can be two separate sets of func, ref, and mask parameters; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. glStencilFunc() sets both front and back stencil state to the same values, as if glStencilFuncSeparate() were called with face set to GL_FRONT_AND_BACK.
                        .PP func is a symbolic constant that determines the stencil comparison function. It accepts one of eight values, shown in the following list. ref is an integer reference value that is used in the stencil comparison. It is clamped to the range 0 2 n - 1, where n is the number of bitplanes in the stencil buffer. mask is bitwise ANDed with both the reference value and the stored stencil value, with the ANDed values participating in the comparison.
                        .PP If stencil represents the value stored in the corresponding stencil buffer location, the following list shows the effect of each comparison function that can be specified by func. Only if the comparison succeeds is the pixel passed through to the next stage in the rasterization process (see glStencilOp()). All tests treat stencil values as unsigned integers in the range 0 2 n - 1, where n is the number of bitplanes in the stencil buffer.
                        .PP The following values are accepted by func:

                            .PP GL_NEVER

                                        Always fails.

                                .RE
                                .PP GL_LESS

                                            Passes if ( ref & mask ) < ( stencil & mask ).

                                    .RE
                                    .PP GL_LEQUAL

                                                Passes if ( ref & mask ) <= ( stencil & mask ).

                                        .RE
                                        .PP GL_GREATER

                                                    Passes if ( ref & mask ) > ( stencil & mask ).

                                            .RE
                                            .PP GL_GEQUAL

                                                        Passes if ( ref & mask ) >= ( stencil & mask ).

                                                .RE
                                                .PP GL_EQUAL

                                                            Passes if ( ref & mask ) = ( stencil & mask ).

                                                    .RE
                                                    .PP GL_NOTEQUAL

                                                                Passes if ( ref & mask ) != ( stencil & mask ).

                                                        .RE
                                                        .PP GL_ALWAYS

                                                                    Always passes.

                                                            .RE

                                                    .SH "NOTES"
                                                        .PP Initially, the stencil test is disabled. If there is no stencil buffer, no stencil modification can occur and it is as if the stencil test always passes.

                                                    .SH "ERRORS"
                                                        .PP GL_INVALID_ENUM is generated if func is not one of the eight accepted values.

                                                    .SH "ASSOCIATED GETS"
                                                        .PP glGet() with argument GL_STENCIL_FUNC, GL_STENCIL_VALUE_MASK, GL_STENCIL_REF, GL_STENCIL_BACK_FUNC, GL_STENCIL_BACK_VALUE_MASK, GL_STENCIL_BACK_REF, or GL_STENCIL_BITS
                                                        .PP glIsEnabled() with argument GL_STENCIL_TEST

                                                    .SH "VERSION SUPPORT"
                                                        .TS allbox tab(:); lB cB s s s s s s s s s s s lB cB cB cB cB cB cB cB cB cB cB cB cB. T{ T}:T{ OpenGL Version T} T{ Function / Feature Name T}:T{ 2.0 T}:T{ 2.1 T}:T{ 3.0 T}:T{ 3.1 T}:T{ 3.2 T}:T{ 3.3 T}:T{ 4.0 T}:T{ 4.1 T}:T{ 4.2 T}:T{ 4.3 T}:T{ 4.4 T}:T{ 4.5 T} l c c c c c c c c c c c c. T{ glStencilFuncSeparate T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}

                                                    .SH "SEE ALSO"
                                                        .PP glBlendFunc(), glDepthFunc(), glEnable(), glLogicOp(), glStencilFunc(), glStencilMask(), glStencilMaskSeparate(), glStencilOp(), glStencilOpSeparate()

                                                    .SH "COPYRIGHT"
                                                        .PP 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. https://opencontent.org/openpub/.

COPYRIGHT
Copyright © 1991-2006 Silicon Graphics, Inc.