2014-03-28 19:06:55 +00:00
|
|
|
<!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="glStencilOpSeparate">
|
|
|
|
<info>
|
2013-11-03 11:43:50 +00:00
|
|
|
<copyright>
|
|
|
|
<year>1991-2006</year>
|
|
|
|
<holder>Silicon Graphics, Inc.</holder>
|
|
|
|
</copyright>
|
2014-03-28 19:06:55 +00:00
|
|
|
<copyright>
|
|
|
|
<year>2010-2014</year>
|
|
|
|
<holder>Khronos Group</holder>
|
|
|
|
</copyright>
|
|
|
|
</info>
|
2009-03-08 00:46:58 +00:00
|
|
|
<refmeta>
|
|
|
|
<refentrytitle>glStencilOpSeparate</refentrytitle>
|
|
|
|
<manvolnum>3G</manvolnum>
|
|
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
|
|
<refname>glStencilOpSeparate</refname>
|
|
|
|
<refpurpose>set front and/or back stencil test actions</refpurpose>
|
|
|
|
</refnamediv>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsynopsisdiv>
|
|
|
|
<title>C Specification</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<funcsynopsis>
|
|
|
|
<funcprototype>
|
|
|
|
<funcdef>void <function>glStencilOpSeparate</function></funcdef>
|
|
|
|
<paramdef>GLenum <parameter>face</parameter></paramdef>
|
|
|
|
<paramdef>GLenum <parameter>sfail</parameter></paramdef>
|
|
|
|
<paramdef>GLenum <parameter>dpfail</parameter></paramdef>
|
|
|
|
<paramdef>GLenum <parameter>dppass</parameter></paramdef>
|
|
|
|
</funcprototype>
|
|
|
|
</funcsynopsis>
|
|
|
|
</refsynopsisdiv>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="parameters"><title>Parameters</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<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>sfail</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specifies the action to take when the stencil test fails.
|
|
|
|
Eight symbolic constants are accepted:
|
|
|
|
<constant>GL_KEEP</constant>,
|
|
|
|
<constant>GL_ZERO</constant>,
|
|
|
|
<constant>GL_REPLACE</constant>,
|
|
|
|
<constant>GL_INCR</constant>,
|
|
|
|
<constant>GL_INCR_WRAP</constant>,
|
|
|
|
<constant>GL_DECR</constant>,
|
|
|
|
<constant>GL_DECR_WRAP</constant>, and
|
|
|
|
<constant>GL_INVERT</constant>. The initial value is <constant>GL_KEEP</constant>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>dpfail</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specifies the stencil action when the stencil test passes,
|
|
|
|
but the depth test fails.
|
|
|
|
<parameter>dpfail</parameter> accepts the same symbolic constants as <parameter>sfail</parameter>. The initial value
|
|
|
|
is <constant>GL_KEEP</constant>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>dppass</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
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.
|
|
|
|
<parameter>dppass</parameter> accepts the same symbolic constants as <parameter>sfail</parameter>. The initial value
|
|
|
|
is <constant>GL_KEEP</constant>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="description"><title>Description</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<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 value in the stencil buffer and a
|
|
|
|
reference value. To enable and disable the test, call <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>
|
|
|
|
and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry> with argument
|
2013-11-03 11:43:50 +00:00
|
|
|
<constant>GL_STENCIL_TEST</constant>; to control it, call
|
|
|
|
<citerefentry><refentrytitle>glStencilFunc</refentrytitle></citerefentry> or
|
2009-03-08 00:46:58 +00:00
|
|
|
<citerefentry><refentrytitle>glStencilFuncSeparate</refentrytitle></citerefentry>.
|
|
|
|
</para>
|
|
|
|
<para>
|
2013-11-03 11:43:50 +00:00
|
|
|
There can be two separate sets of <parameter>sfail</parameter>, <parameter>dpfail</parameter>, and
|
2009-03-08 00:46:58 +00:00
|
|
|
<parameter>dppass</parameter> parameters; one affects back-facing polygons, and the other
|
2013-11-03 11:43:50 +00:00
|
|
|
affects front-facing polygons as well as other non-polygon primitives.
|
2009-03-08 00:46:58 +00:00
|
|
|
<citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry> sets both front
|
2013-11-03 11:43:50 +00:00
|
|
|
and back stencil state to the same values, as if
|
2014-03-28 19:06:55 +00:00
|
|
|
<function>glStencilOpSeparate</function> were called
|
2009-03-08 00:46:58 +00:00
|
|
|
with <parameter>face</parameter> set to <constant>GL_FRONT_AND_BACK</constant>.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<function>glStencilOpSeparate</function> 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 <parameter>sfail</parameter> specifies what happens to the stencil buffer contents.
|
|
|
|
The following eight actions are possible.
|
|
|
|
</para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><constant>GL_KEEP</constant></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Keeps the current value.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><constant>GL_ZERO</constant></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the stencil buffer value to 0.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><constant>GL_REPLACE</constant></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Sets the stencil buffer value to <emphasis>ref</emphasis>,
|
|
|
|
as specified by <citerefentry><refentrytitle>glStencilFunc</refentrytitle></citerefentry>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><constant>GL_INCR</constant></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Increments the current stencil buffer value.
|
|
|
|
Clamps to the maximum representable unsigned value.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><constant>GL_INCR_WRAP</constant></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Increments the current stencil buffer value.
|
|
|
|
Wraps stencil buffer value to zero when incrementing the maximum
|
|
|
|
representable unsigned value.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><constant>GL_DECR</constant></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Decrements the current stencil buffer value.
|
|
|
|
Clamps to 0.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><constant>GL_DECR_WRAP</constant></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Decrements the current stencil buffer value.
|
|
|
|
Wraps stencil buffer value to the maximum representable unsigned value when
|
|
|
|
decrementing a stencil buffer value of zero.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><constant>GL_INVERT</constant></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Bitwise inverts the current stencil buffer value.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
<para>
|
|
|
|
Stencil buffer values are treated as unsigned integers.
|
|
|
|
When incremented and decremented,
|
2013-11-03 11:43:50 +00:00
|
|
|
values are clamped to 0 and
|
2014-03-28 19:06:55 +00:00
|
|
|
<inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
|
2009-03-08 00:46:58 +00:00
|
|
|
<!-- eqn: 2 sup n - 1:-->
|
|
|
|
<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:math></inlineequation>,
|
2013-11-03 11:43:50 +00:00
|
|
|
where
|
2014-03-28 19:06:55 +00:00
|
|
|
<inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"><mml:mi mathvariant="italic">n</mml:mi></mml:math></inlineequation>
|
2009-03-08 00:46:58 +00:00
|
|
|
is the value returned by querying <constant>GL_STENCIL_BITS</constant>.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The other two arguments to <function>glStencilOpSeparate</function> specify stencil buffer actions
|
|
|
|
that depend on whether subsequent depth buffer tests succeed (<parameter>dppass</parameter>)
|
|
|
|
or fail (<parameter>dpfail</parameter>) (see
|
|
|
|
<citerefentry><refentrytitle>glDepthFunc</refentrytitle></citerefentry>).
|
|
|
|
The actions are specified using the same eight symbolic constants as <parameter>sfail</parameter>.
|
|
|
|
Note that <parameter>dpfail</parameter> is ignored when there is no depth buffer,
|
|
|
|
or when the depth buffer is not enabled.
|
|
|
|
In these cases, <parameter>sfail</parameter> and <parameter>dppass</parameter> specify stencil action when the
|
|
|
|
stencil test fails and passes,
|
|
|
|
respectively.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="notes"><title>Notes</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<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>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="errors"><title>Errors</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
2013-11-03 11:43:50 +00:00
|
|
|
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>face</parameter> is any value
|
2009-03-08 00:46:58 +00:00
|
|
|
other than <constant>GL_FRONT</constant>, <constant>GL_BACK</constant>, or <constant>GL_FRONT_AND_BACK</constant>.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>sfail</parameter>,
|
|
|
|
<parameter>dpfail</parameter>, or <parameter>dppass</parameter> is any value other than the eight defined constant values.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="associatedgets"><title>Associated Gets</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
2013-11-03 11:43:50 +00:00
|
|
|
<citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument
|
|
|
|
<constant>GL_STENCIL_FAIL</constant>, <constant>GL_STENCIL_PASS_DEPTH_PASS</constant>,
|
|
|
|
<constant>GL_STENCIL_PASS_DEPTH_FAIL</constant>, <constant>GL_STENCIL_BACK_FAIL</constant>,
|
2009-03-08 00:46:58 +00:00
|
|
|
<constant>GL_STENCIL_BACK_PASS_DEPTH_PASS</constant>, <constant>GL_STENCIL_BACK_PASS_DEPTH_FAIL</constant>,
|
|
|
|
or <constant>GL_STENCIL_BITS</constant>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_STENCIL_TEST</constant>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="versions">
|
|
|
|
<title>API Version Support</title>
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="4" align="left">
|
|
|
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apifunchead.xml" xpointer="xpointer(/*/*)"/>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry>glStencilOpSeparate</entry>
|
|
|
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apiversion.xml" xpointer="xpointer(/*/*[@role='es20']/*)"/>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 xml:id="seealso"><title>See Also</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
|
|
|
<citerefentry><refentrytitle>glDepthFunc</refentrytitle></citerefentry>,
|
|
|
|
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>,
|
|
|
|
<citerefentry><refentrytitle>glStencilFunc</refentrytitle></citerefentry>,
|
|
|
|
<citerefentry><refentrytitle>glStencilFuncSeparate</refentrytitle></citerefentry>,
|
|
|
|
<citerefentry><refentrytitle>glStencilMask</refentrytitle></citerefentry>,
|
|
|
|
<citerefentry><refentrytitle>glStencilMaskSeparate</refentrytitle></citerefentry>,
|
|
|
|
<citerefentry><refentrytitle>glStencilOp</refentrytitle></citerefentry>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2014-03-28 19:06:55 +00:00
|
|
|
<refsect1 xml:id="Copyright"><title>Copyright</title>
|
2009-03-08 00:46:58 +00:00
|
|
|
<para>
|
2014-03-28 19:06:55 +00:00
|
|
|
Copyright <trademark class="copyright"/> 1991-2006 Silicon Graphics, Inc.
|
|
|
|
Copyright <trademark class="copyright"/> 2010-2014 Khronos Group.
|
|
|
|
This document is licensed under the SGI Free Software B License.
|
|
|
|
For details, see
|
|
|
|
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</link>.
|
2009-03-08 00:46:58 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|