alphafunc.3gl   [plain text]


'\" 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 alphafunc
.ds Xs 25246 5 alphafunc.gl
.TH GLALPHAFUNC 3G
.SH NAME
.B "glAlphaFunc
\- specify the alpha test function

.SH C SPECIFICATION
void \f3glAlphaFunc\fP(
GLenum \fIfunc\fP,
.nf
.ta \w'\f3void \fPglAlphaFunc( 'u
	GLclampf \fIref\fP )
.fi

.SH PARAMETERS
.TP \w'\f2func\fP\ \ 'u 
\f2func\fP
Specifies the alpha comparison function.
Symbolic constants
\%\f3GL_NEVER\fP,
\%\f3GL_LESS\fP,
\%\f3GL_EQUAL\fP,
\%\f3GL_LEQUAL\fP,
\%\f3GL_GREATER\fP,
\%\f3GL_NOTEQUAL\fP,
\%\f3GL_GEQUAL\fP, and
\%\f3GL_ALWAYS\fP are accepted. The initial value is \%\f3GL_ALWAYS\fP.
.TP
\f2ref\fP
Specifies the reference value that incoming alpha values are compared to.
This value is clamped to the range [0,\ 1],
where 0 represents the lowest possible alpha value
and 1 the highest possible value.
The initial reference value is 0.
.SH DESCRIPTION
The alpha test discards fragments depending on the outcome of a comparison
between an incoming fragment's alpha value and a constant reference value.
\%\f3glAlphaFunc\fP specifies the reference value and the comparison function.
The comparison is performed only if alpha testing is enabled. By
default, it is not enabled. 
(See 
\%\f3glEnable\fP and \%\f3glDisable\fP of \%\f3GL_ALPHA_TEST\fP.)
.P
\f2func\fP and \f2ref\fP specify the conditions under which
the pixel is drawn.
The incoming alpha value is compared to \f2ref\fP
using the function specified by \f2func\fP.
If the value passes the comparison,
the incoming fragment is drawn
if it also passes subsequent stencil and depth buffer tests. 
If the value fails the comparison,
no change is made to the frame buffer at that pixel location. The
comparison functions are as follows: 
.TP 18
\%\f3GL_NEVER\fP
Never passes. 
.TP
\%\f3GL_LESS\fP
Passes if the incoming alpha value is less than the reference value.
.TP
\%\f3GL_EQUAL\fP
Passes if the incoming alpha value is equal to the reference value.
.TP
\%\f3GL_LEQUAL\fP
Passes if the incoming alpha value is less than or equal to the reference value.
.TP
\%\f3GL_GREATER\fP 
Passes if the incoming alpha value is greater than the reference value.
.TP
\%\f3GL_NOTEQUAL\fP
Passes if the incoming alpha value is not equal to the reference value.
.TP
\%\f3GL_GEQUAL\fP
Passes if the incoming alpha value is greater than or equal to
the reference value.
.TP
\%\f3GL_ALWAYS\fP
Always passes (initial value). 
.P
\%\f3glAlphaFunc\fP operates on all pixel write operations,
including those resulting from the scan conversion of points,
lines,
polygons,
and bitmaps,
and from pixel draw and copy operations.
\%\f3glAlphaFunc\fP does not affect screen clear operations.
.SH NOTES
Alpha testing is performed only in RGBA mode.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2func\fP is not an accepted value.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glAlphaFunc\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_ALPHA_TEST_FUNC\fP
.br
\%\f3glGet\fP with argument \%\f3GL_ALPHA_TEST_REF\fP
.br
\%\f3glIsEnabled\fP with argument \%\f3GL_ALPHA_TEST\fP
.SH SEE ALSO
\%\f3glBlendFunc(3G)\fP,
\%\f3glClear(3G)\fP,
\%\f3glDepthFunc(3G)\fP,
\%\f3glEnable(3G)\fP,
\%\f3glStencilFunc(3G)\fP