File: glStencilFuncSeparate.xml

package info (click to toggle)
khronos-opengl-man4 1.0~svn31251-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,368 kB
  • ctags: 267
  • sloc: xml: 93,382; makefile: 730; python: 627; sh: 50; php: 4
file content (315 lines) | stat: -rw-r--r-- 15,705 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!DOCTYPE refentry [ <!ENTITY % mathent SYSTEM "math.ent"> %mathent; ]>

<!-- Converted by db4-upgrade version 1.1 -->

<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="glStencilFuncSeparate">
    <info>
        <copyright>
            <year>1991-2006</year>
            <holder>Silicon Graphics, Inc.</holder>
        </copyright>
    </info>
    <refmeta>
        <refentrytitle>glStencilFuncSeparate</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glStencilFuncSeparate</refname>
        <refpurpose>set front and/or back function and reference value for stencil testing</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glStencilFuncSeparate</function></funcdef>
                <paramdef>GLenum <parameter>face</parameter></paramdef>
                <paramdef>GLenum <parameter>func</parameter></paramdef>
                <paramdef>GLint <parameter>ref</parameter></paramdef>
                <paramdef>GLuint <parameter>mask</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 xml:id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>face</parameter></term>
            <listitem>
                <para>
                    Specifies whether front and/or back stencil state is updated.
                    Three symbolic constants are valid:
                    <constant>GL_FRONT</constant>,
                    <constant>GL_BACK</constant>, and
                    <constant>GL_FRONT_AND_BACK</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>func</parameter></term>
            <listitem>
                <para>
                    Specifies the test function.
                    Eight symbolic constants are valid:
                    <constant>GL_NEVER</constant>,
                    <constant>GL_LESS</constant>,
                    <constant>GL_LEQUAL</constant>,
                    <constant>GL_GREATER</constant>,
                    <constant>GL_GEQUAL</constant>,
                    <constant>GL_EQUAL</constant>,
                    <constant>GL_NOTEQUAL</constant>, and
                    <constant>GL_ALWAYS</constant>. The initial value is <constant>GL_ALWAYS</constant>.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>ref</parameter></term>
            <listitem>
                <para>
                    Specifies the reference value for the stencil test.
                    <parameter>ref</parameter> is clamped to the range
                    <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                        <!-- eqn: [0, 2 sup n - 1]:-->
                        <mml:mfenced open="[" close="]">
                            <mml:mn>0</mml:mn>
                            <mml:mrow>
                                <mml:msup><mml:mn>2</mml:mn>
                                <mml:mi mathvariant="italic">n</mml:mi>
                                </mml:msup>
                                <mml:mo>-</mml:mo>
                                <mml:mn>1</mml:mn>
                            </mml:mrow>
                        </mml:mfenced>
                    </mml:math></inlineequation>,
                    where
                    <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math></inlineequation>
                    is the number of bitplanes in the stencil buffer. The
                    initial value is 0.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>mask</parameter></term>
            <listitem>
                <para>
                    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.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 xml:id="description"><title>Description</title>
        <para>
            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.
        </para>
        <para>
            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 <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry>
            with argument <constant>GL_STENCIL_TEST</constant>.
            To specify actions based on the outcome of the stencil test, call
            <citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry> or
            <citerefentry><refentrytitle>glStencilOpSeparate</refentrytitle></citerefentry>.
        </para>
        <para>
            There can be two separate sets of <parameter>func</parameter>, <parameter>ref</parameter>, and
            <parameter>mask</parameter> parameters; one affects back-facing polygons, and the other
            affects front-facing polygons as well as other non-polygon primitives.
            <citerefentry><refentrytitle>glStencilFunc</refentrytitle></citerefentry> sets both front
            and back stencil state to the same values, as if
            <citerefentry><refentrytitle>glStencilFuncSeparate</refentrytitle></citerefentry> were called
            with <parameter>face</parameter> set to <constant>GL_FRONT_AND_BACK</constant>.
        </para>
        <para>
            <parameter>func</parameter> is a symbolic constant that determines the stencil comparison function.
            It accepts one of eight values,
            shown in the following list.
            <parameter>ref</parameter> is an integer reference value that is used in the stencil comparison.
            It is clamped to the range
            <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                <!-- eqn: [0, 2 sup n - 1]:-->
                <mml:mfenced open="[" close="]">
                    <mml:mn>0</mml:mn>
                    <mml:mrow>
                        <mml:msup><mml:mn>2</mml:mn>
                        <mml:mi mathvariant="italic">n</mml:mi>
                        </mml:msup>
                        <mml:mo>-</mml:mo>
                        <mml:mn>1</mml:mn>
                    </mml:mrow>
                </mml:mfenced>
            </mml:math></inlineequation>,
            where
            <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math></inlineequation>
            is the number of bitplanes in the stencil buffer.
            <parameter>mask</parameter> is bitwise ANDed with both the reference value
            and the stored stencil value,
            with the ANDed values participating in the comparison.
        </para>
        <para>
            If <emphasis>stencil</emphasis> 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 <parameter>func</parameter>.
            Only if the comparison succeeds is the pixel passed through
            to the next stage in the rasterization process
            (see <citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry>).
            All tests treat <emphasis>stencil</emphasis> values as unsigned integers in the range
            <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                <!-- eqn: [0, 2 sup n - 1]:-->
                <mml:mfenced open="[" close="]">
                    <mml:mn>0</mml:mn>
                    <mml:mrow>
                        <mml:msup><mml:mn>2</mml:mn>
                        <mml:mi mathvariant="italic">n</mml:mi>
                        </mml:msup>
                        <mml:mo>-</mml:mo>
                        <mml:mn>1</mml:mn>
                    </mml:mrow>
                </mml:mfenced>
            </mml:math></inlineequation>,
            where
            <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math></inlineequation>
            is the number of bitplanes in the stencil buffer.
        </para>
        <para>
            The following values are accepted by <parameter>func</parameter>:
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>GL_NEVER</constant></term>
                <listitem>
                    <para>
                        Always fails.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_LESS</constant></term>
                <listitem>
                    <para>
                        Passes if ( <parameter>ref</parameter> &amp; <parameter>mask</parameter> ) &lt; ( <emphasis>stencil</emphasis> &amp; <parameter>mask</parameter> ).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_LEQUAL</constant></term>
                <listitem>
                    <para>
                        Passes if ( <parameter>ref</parameter> &amp; <parameter>mask</parameter> ) &lt;= ( <emphasis>stencil</emphasis> &amp; <parameter>mask</parameter> ).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_GREATER</constant></term>
                <listitem>
                    <para>
                        Passes if ( <parameter>ref</parameter> &amp; <parameter>mask</parameter> ) &gt; ( <emphasis>stencil</emphasis> &amp; <parameter>mask</parameter> ).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_GEQUAL</constant></term>
                <listitem>
                    <para>
                        Passes if ( <parameter>ref</parameter> &amp; <parameter>mask</parameter> ) &gt;= ( <emphasis>stencil</emphasis> &amp; <parameter>mask</parameter> ).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_EQUAL</constant></term>
                <listitem>
                    <para>
                        Passes if ( <parameter>ref</parameter> &amp; <parameter>mask</parameter> ) = ( <emphasis>stencil</emphasis> &amp; <parameter>mask</parameter> ).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_NOTEQUAL</constant></term>
                <listitem>
                    <para>
                        Passes if ( <parameter>ref</parameter> &amp; <parameter>mask</parameter> ) != ( <emphasis>stencil</emphasis> &amp; <parameter>mask</parameter> ).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>GL_ALWAYS</constant></term>
                <listitem>
                    <para>
                        Always passes.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 xml:id="notes"><title>Notes</title>
        <para>
            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.
        </para>
    </refsect1>
    <refsect1 xml:id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>func</parameter> is not one of the eight
            accepted values.
        </para>
    </refsect1>
    <refsect1 xml:id="associatedgets"><title>Associated Gets</title>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument
            <constant>GL_STENCIL_FUNC</constant>, <constant>GL_STENCIL_VALUE_MASK</constant>,
            <constant>GL_STENCIL_REF</constant>, <constant>GL_STENCIL_BACK_FUNC</constant>,
            <constant>GL_STENCIL_BACK_VALUE_MASK</constant>, <constant>GL_STENCIL_BACK_REF</constant>,
            or <constant>GL_STENCIL_BITS</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_STENCIL_TEST</constant>
        </para>
    </refsect1>
    <refsect1 xml:id="versions"><title>Version Support</title>
        <informaltable>
            <tgroup cols="13" align="left">
                <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
                <tbody>
                    <row>
                        <entry><function>glStencilFuncSeparate</function></entry>
                        <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='20']/*)"/>
                    </row>
                </tbody>
            </tgroup>
        </informaltable>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glBlendFunc</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glDepthFunc</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glLogicOp</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilFunc</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilMask</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilMaskSeparate</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glStencilOpSeparate</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 xml:id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="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.
            <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://opencontent.org/openpub/">http://opencontent.org/openpub/</link>.
        </para>
    </refsect1>
</refentry>