1GLSTENCILOP(3G)                 [FIXME: manual]                GLSTENCILOP(3G)
2
3
4

NAME

6       glStencilOp - set front and back stencil test actions
7

C SPECIFICATION

9       void glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass);
10

PARAMETERS

12       sfail
13           Specifies the action to take when the stencil test fails. Eight
14           symbolic constants are accepted: GL_KEEP, GL_ZERO, GL_REPLACE,
15           GL_INCR, GL_INCR_WRAP, GL_DECR, GL_DECR_WRAP, and GL_INVERT. The
16           initial value is GL_KEEP.
17
18       dpfail
19           Specifies the stencil action when the stencil test passes, but the
20           depth test fails.  dpfail accepts the same symbolic constants as
21           sfail. The initial value is GL_KEEP.
22
23       dppass
24           Specifies the stencil action when both the stencil test and the
25           depth test pass, or when the stencil test passes and either there
26           is no depth buffer or depth testing is not enabled.  dppass accepts
27           the same symbolic constants as sfail. The initial value is GL_KEEP.
28

DESCRIPTION

30       Stenciling, like depth-buffering, enables and disables drawing on a
31       per-pixel basis. You draw into the stencil planes using GL drawing
32       primitives, then render geometry and images, using the stencil planes
33       to mask out portions of the screen. Stenciling is typically used in
34       multipass rendering algorithms to achieve special effects, such as
35       decals, outlining, and constructive solid geometry rendering.
36
37       The stencil test conditionally eliminates a pixel based on the outcome
38       of a comparison between the value in the stencil buffer and a reference
39       value. To enable and disable the test, call glEnable() and
40
41       glDisable with argument GL_STENCIL_TEST; to control it, call
42       glStencilFunc() or glStencilFuncSeparate().
43
44       There can be two separate sets of sfail, dpfail, and dppass parameters;
45       one affects back-facing polygons, and the other affects front-facing
46       polygons as well as other non-polygon primitives.  glStencilOp() sets
47       both front and back stencil state to the same values. Use
48       glStencilOpSeparate() to set front and back stencil state to different
49       values.
50
51       glStencilOp takes three arguments that indicate what happens to the
52       stored stencil value while stenciling is enabled. If the stencil test
53       fails, no change is made to the pixel's color or depth buffers, and
54       sfail specifies what happens to the stencil buffer contents. The
55       following eight actions are possible.
56
57       GL_KEEP
58           Keeps the current value.
59
60       GL_ZERO
61           Sets the stencil buffer value to 0.
62
63       GL_REPLACE
64           Sets the stencil buffer value to ref, as specified by
65           glStencilFunc().
66
67       GL_INCR
68           Increments the current stencil buffer value. Clamps to the maximum
69           representable unsigned value.
70
71       GL_INCR_WRAP
72           Increments the current stencil buffer value. Wraps stencil buffer
73           value to zero when incrementing the maximum representable unsigned
74           value.
75
76       GL_DECR
77           Decrements the current stencil buffer value. Clamps to 0.
78
79       GL_DECR_WRAP
80           Decrements the current stencil buffer value. Wraps stencil buffer
81           value to the maximum representable unsigned value when decrementing
82           a stencil buffer value of zero.
83
84       GL_INVERT
85           Bitwise inverts the current stencil buffer value.
86
87       Stencil buffer values are treated as unsigned integers. When
88       incremented and decremented, values are clamped to 0 and 2 n - 1, where
89       n is the value returned by querying GL_STENCIL_BITS.
90
91       The other two arguments to glStencilOp specify stencil buffer actions
92       that depend on whether subsequent depth buffer tests succeed (dppass)
93       or fail (dpfail) (see glDepthFunc()). The actions are specified using
94       the same eight symbolic constants as sfail. Note that dpfail is ignored
95       when there is no depth buffer, or when the depth buffer is not enabled.
96       In these cases, sfail and dppass specify stencil action when the
97       stencil test fails and passes, respectively.
98

NOTES

100       Initially the stencil test is disabled. If there is no stencil buffer,
101       no stencil modification can occur and it is as if the stencil tests
102       always pass, regardless of any call to glStencilOp.
103
104       glStencilOp() is the same as calling glStencilOpSeparate() with face
105       set to GL_FRONT_AND_BACK.
106

ERRORS

108       GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value
109       other than the defined constant values.
110

ASSOCIATED GETS

112       glGet() with argument GL_STENCIL_FAIL, GL_STENCIL_PASS_DEPTH_PASS,
113       GL_STENCIL_PASS_DEPTH_FAIL, GL_STENCIL_BACK_FAIL,
114       GL_STENCIL_BACK_PASS_DEPTH_PASS, GL_STENCIL_BACK_PASS_DEPTH_FAIL, or
115       GL_STENCIL_BITS
116
117       glIsEnabled() with argument GL_STENCIL_TEST
118

VERSION SUPPORT

120       ┌────────────┬───────────────────────────────────────────────────────────────────────┐
121       │            │                OpenGL Version                                         
122       ├────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
123Function    2.0 2.1 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3 4.4 4.5 
124/           │     │     │     │     │     │     │     │     │     │     │     │     │
125Feature     │     │     │     │     │     │     │     │     │     │     │     │     │
126Name        │     │     │     │     │     │     │     │     │     │     │     │     │
127       ├────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
128glStencilOp │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │
129       └────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
130

SEE ALSO

132       glBlendFunc(), glDepthFunc(), glEnable(), glLogicOp(), glStencilFunc(),
133       glStencilFuncSeparate(), glStencilMask(), glStencilMaskSeparate(),
134       glStencilOpSeparate()
135
137       Copyright © 1991-2006 Silicon Graphics, Inc. Copyright © 2010-2014
138       Khronos Group. This document is licensed under the SGI Free Software B
139       License. For details, see http://oss.sgi.com/projects/FreeB/.
140
142       Copyright © 1991-2006 Silicon Graphics, Inc.
143       Copyright © 2010-2014 Khronos Group
144
145
146
147[FIXME: source]                   03/06/2019                   GLSTENCILOP(3G)
Impressum