File: stencilfunc.3gl

package info (click to toggle)
vnc4 4.1.1%2BX4.3.0-37
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 171,636 kB
  • ctags: 288,245
  • sloc: ansic: 2,205,268; cpp: 56,345; sh: 38,092; pascal: 13,773; asm: 12,656; tcl: 9,182; lisp: 7,831; perl: 3,364; makefile: 2,957; yacc: 2,902; objc: 2,698; xml: 2,614; python: 2,383; lex: 1,477; awk: 901; csh: 58; sed: 50
file content (147 lines) | stat: -rw-r--r-- 4,470 bytes parent folder | download | duplicates (6)
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
'\" te
'\"! tbl|eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 stencilfu
.ds Xs 21383 6 stencilfunc.gl
.TH GLSTENCILFUNC 3G
.SH NAME
.B "glStencilFunc
\- set function and reference value for stencil testing

.EQ
delim $$
.EN
.SH C SPECIFICATION
void \f3glStencilFunc\fP(
GLenum \fIfunc\fP,
.nf
.ta \w'\f3void \fPglStencilFunc( 'u
	GLint \fIref\fP,
	GLuint \fImask\fP )
.fi

.SH PARAMETERS
.TP \w'\f2func\fP\ \ 'u 
\f2func\fP
Specifies the test function.
Eight tokens are valid:
\%\f3GL_NEVER\fP,
\%\f3GL_LESS\fP,
\%\f3GL_LEQUAL\fP,
\%\f3GL_GREATER\fP,
\%\f3GL_GEQUAL\fP,
\%\f3GL_EQUAL\fP,
\%\f3GL_NOTEQUAL\fP, and
\%\f3GL_ALWAYS\fP. The initial value is \%\f3GL_ALWAYS\fP. 
.TP
\f2ref\fP
Specifies the reference value for the stencil test.
\f2ref\fP is clamped to the range [0,$2 sup n - 1$],
where $n$ is the number of bitplanes in the stencil buffer. The
initial value is 0.
.TP
\f2mask\fP
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. 
.SH DESCRIPTION
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
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 \%\f3glEnable\fP and \%\f3glDisable\fP
with argument \%\f3GL_STENCIL_TEST\fP.
To specify actions based on the outcome of the stencil test, call
\%\f3glStencilOp\fP.
.P
\f2func\fP is a symbolic constant that determines the stencil comparison function.
It accepts one of eight values,
shown in the following list.
\f2ref\fP is an integer reference value that is used in the stencil comparison.
It is clamped to the range [0,$2 sup n - 1$],
where $n$ is the number of bitplanes in the stencil buffer.
\f2mask\fP is bitwise ANDed with both the reference value
and the stored stencil value,
with the ANDed values participating in the comparison.
.P 
If \f2stencil\fP 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 \f2func\fP.
Only if the comparison succeeds is the pixel passed through
to the next stage in the rasterization process
(see \%\f3glStencilOp\fP).
All tests treat \f2stencil\fP values as unsigned integers in the range
[0,$2 sup n - 1$],
where $n$ is the number of bitplanes in the stencil buffer.
.P
The following values are accepted by \f2func\fP:
.TP 18
\%\f3GL_NEVER\fP
Always fails.
.TP
\%\f3GL_LESS\fP
Passes if ( \f2ref\fP & \f2mask\fP ) < ( \f2stencil\fP & \f2mask\fP ). 
.TP
\%\f3GL_LEQUAL\fP
Passes if ( \f2ref\fP & \f2mask\fP ) \(<= ( \f2stencil\fP & \f2mask\fP ).
.TP
\%\f3GL_GREATER\fP
Passes if ( \f2ref\fP & \f2mask\fP ) > ( \f2stencil\fP & \f2mask\fP ).
.TP
\%\f3GL_GEQUAL\fP
Passes if ( \f2ref\fP & \f2mask\fP ) \(>= ( \f2stencil\fP & \f2mask\fP ).
.TP
\%\f3GL_EQUAL\fP
Passes if ( \f2ref\fP & \f2mask\fP ) = ( \f2stencil\fP & \f2mask\fP ).
.TP
\%\f3GL_NOTEQUAL\fP
Passes if ( \f2ref\fP & \f2mask\fP ) \(!=  ( \f2stencil\fP & \f2mask\fP ).
.TP
\%\f3GL_ALWAYS\fP
Always passes.
.SH NOTES
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
\%\f3GL_INVALID_ENUM\fP is generated if \f2func\fP is not one of the eight
accepted values.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glStencilFunc\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_STENCIL_FUNC\fP
.br
\%\f3glGet\fP with argument \%\f3GL_STENCIL_VALUE_MASK\fP
.br
\%\f3glGet\fP with argument \%\f3GL_STENCIL_REF\fP
.br
\%\f3glGet\fP with argument \%\f3GL_STENCIL_BITS\fP
.br
\%\f3glIsEnabled\fP with argument \%\f3GL_STENCIL_TEST\fP
.SH SEE ALSO
\%\f3glAlphaFunc(3G)\fP,
\%\f3glBlendFunc(3G)\fP,
\%\f3glDepthFunc(3G)\fP,
\%\f3glEnable(3G)\fP,
\%\f3glIsEnabled(3G)\fP,
\%\f3glLogicOp(3G)\fP,
\%\f3glStencilOp(3G)\fP