File: glStencilOp.3G.xml

package info (click to toggle)
pyopengl 2.0.1.08-5.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 19,484 kB
  • ctags: 9,036
  • sloc: pascal: 64,950; xml: 28,088; ansic: 20,696; python: 19,761; tcl: 668; makefile: 240; sh: 25
file content (90 lines) | stat: -rw-r--r-- 9,080 bytes parent folder | download
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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glStencilOp</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glStencilMask.3G.xml" title="glStencilMask"/><link rel="next" href="glTexCoord.3G.xml" title="glTexCoord"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glStencilOp</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glStencilMask.3G.xml">Prev</a></td><th width="60%" align="center">GL</th><td width="20%" align="right"><a accesskey="n" href="glTexCoord.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glStencilOp.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glStencilOp.3G-name"/><h2>Name</h2><p>glStencilOp &#8212; set stencil test actions</p></div><div class="refsynopsisdiv"><a name="glStencilOp.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void<tt>glStencilOp</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum<i><tt>fail</tt></i>, GLenum<i><tt>zfail</tt></i>, GLenum<i><tt>zpass</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glStencilOp.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glStencilOp</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>fail</tt></i>, <i><tt>zfail</tt></i>, <i><tt>zpass</tt></i>) &#8594;<tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glStencilOp.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>fail</tt></i></span></dt><dd>
						Specifies the action to take when the stencil test fails. Six symbolic constants are accepted:
						<tt>GL_KEEP</tt>, <tt>GL_ZERO</tt>, <tt>GL_REPLACE</tt>,
						<tt>GL_INCR</tt>, <tt>GL_DECR</tt>, and <tt>GL_INVERT</tt>. The initial
						value is <tt>GL_KEEP</tt>.
					</dd><dt><span class="term"><i><tt>zfail</tt></i></span></dt><dd>
						Specifies the stencil action when the stencil test passes, but the depth test fails.
						<i><tt>zfail</tt></i> accepts the same symbolic constants as <i><tt>fail</tt></i>. The
						initial value is <tt>GL_KEEP</tt>.
					</dd><dt><span class="term"><i><tt>zpass</tt></i></span></dt><dd>
						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. <i><tt>zpass</tt></i>
						accepts the same symbolic constants as <i><tt>fail</tt></i>. The initial value is
						<tt>GL_KEEP</tt>.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glStencilOp.3G-description"/><h2>Description</h2><p>
			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.
		</p><p>
			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 <a href="glEnable.3G.xml"><tt>glEnable</tt></a>
			and <a href="glEnable.3G.xml"><tt>glDisable</tt></a> with argument <tt>GL_STENCIL_TEST</tt>; to control
			it, call <a href="glStencilFunc.3G.xml"><tt>glStencilFunc</tt></a>.
		</p><p>
			<tt>glStencilOp</tt> 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
			<i><tt>fail</tt></i> specifies what happens to the stencil buffer contents. The following six actions are
			possible.
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_KEEP</tt></span></dt><dd>
						Keeps the current value.
					</dd><dt><span class="term"><tt>GL_ZERO</tt></span></dt><dd>
						Sets the stencil buffer value to 0.
					</dd><dt><span class="term"><tt>GL_REPLACE</tt></span></dt><dd>
						Sets the stencil buffer value to <i><tt>ref</tt></i>, as specified by <a href="glStencilFunc.3G.xml"><tt>glStencilFunc</tt></a>.
					</dd><dt><span class="term"><tt>GL_INCR</tt></span></dt><dd>
						Increments the current stencil buffer value. Clamps to the maximum representable unsigned value.
					</dd><dt><span class="term"><tt>GL_DECR</tt></span></dt><dd>
						Decrements the current stencil buffer value. Clamps to 0.
					</dd><dt><span class="term"><tt>GL_INVERT</tt></span></dt><dd>
						Bitwise inverts the current stencil buffer value.
					</dd></dl></div><p>
			Stencil buffer values are treated as unsigned integers. When incremented and decremented, values are clamped to 0 and
			<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mrow>
						<mml:msup>
							<mml:mn>2</mml:mn>
							<mml:mi>n</mml:mi>
						</mml:msup>
						<mml:mo>-</mml:mo>
						<mml:mn>1</mml:mn>
					</mml:mrow>
				</mml:math>, where <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
					<mml:mi>n</mml:mi>
				</mml:math> is the value returned by querying <tt>GL_STENCIL_BITS</tt>.
		</p><p>
			The other two arguments to <tt>glStencilOp</tt> specify stencil buffer actions that depend on whether
			subsequent depth buffer tests succeed (<i><tt>zpass</tt></i>) or fail (<i><tt>zfail</tt></i>) (see
			<a href="glDepthFunc.3G.xml">glDepthFunc</a>). The actions are specified using the same six symbolic constants as <i><tt>fail</tt></i>. Note
			that <i><tt>zfail</tt></i> is ignored when there is no depth buffer, or when the depth buffer is not enabled. In
			these cases, <i><tt>fail</tt></i> and <i><tt>zpass</tt></i> specify stencil action when the stencil test
			fails and passes, respectively.
		</p></div><div class="refsect1" lang="en"><a name="glStencilOp.3G-notes"/><h2>Notes</h2><p>
			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 <tt>glStencilOp</tt>.
		</p></div><div class="refsect1" lang="en"><a name="glStencilOp.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>fail</tt></i>, <i><tt>zfail</tt></i>, or
			<i><tt>zpass</tt></i> is any value other than the six defined constant values.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glStencilOp</tt> is executed between the
			execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of <a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p></div><div class="refsect1" lang="en"><a name="glStencilOp.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_STENCIL_FAIL</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_STENCIL_PASS_DEPTH_PASS</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_STENCIL_PASS_DEPTH_FAIL</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_STENCIL_BITS</tt>
		</p><p>
			<a href="glIsEnabled.3G.xml"><tt>glIsEnabled</tt></a> with argument <tt>GL_STENCIL_TEST</tt>
		</p></div><div class="refsect1" lang="en"><a name="glStencilOp.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glAlphaFunc.3G.xml">glAlphaFunc</a>, <a href="glBlendFunc.3G.xml">glBlendFunc</a>, <a href="glDepthFunc.3G.xml">glDepthFunc</a>, <a href="glEnable.3G.xml">glEnable</a>, <a href="glLogicOp.3G.xml">glLogicOp</a>, <a href="glStencilFunc.3G.xml">glStencilFunc</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glStencilMask.3G.xml">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"><a accesskey="n" href="glTexCoord.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glStencilMask</td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top">glTexCoord</td></tr></table></div></body></html>