glAlphaFunc(3G) OpenGL Reference glAlphaFunc(3G)
NAME
glAlphaFunc - specify the alpha test function
C SPECIFICATION
void glAlphaFunc( GLenum func,
GLclampf ref )
PARAMETERS
func Specifies the alpha comparison function. Symbolic constants
GLNEVER, GLLESS, GLEQUAL, GLLEQUAL, GLGREATER, GLNOTEQUAL,
GLGEQUAL, and GLALWAYS are accepted. The default function is
GLALWAYS.
ref Specifies the reference value that incoming alpha values are
compared to. This value is clamped to the range 0 through 1, where
0 represents the lowest possible alpha value and 1 the highest
possible value. The default reference is 0.
DESCRIPTION
The alpha test discards fragments depending on the outcome of a
comparison between the incoming fragment's alpha value and a constant
reference value. glAlphaFunc specifies the reference and comparison
function. The comparison is performed only if alpha testing is enabled.
(See glEnable and glDisable of GLALPHATEST.)
func and ref specify the conditions under which the pixel is drawn. The
incoming alpha value is compared to ref using the function specified by
func. If the comparison passes, the incoming fragment is drawn,
conditional on subsequent stencil and depth buffer tests. If the
comparison fails, no change is made to the frame buffer at that pixel
location.
The comparison functions are as follows:
GLNEVER Never passes.
GLLESS Passes if the incoming alpha value is less than the
reference value.
GLEQUAL Passes if the incoming alpha value is equal to the
reference value.
GLLEQUAL Passes if the incoming alpha value is less than or
equal to the reference value.
GLGREATER Passes if the incoming alpha value is greater than the
reference value.
Page 1
glAlphaFunc(3G) OpenGL Reference glAlphaFunc(3G)
GLNOTEQUAL Passes if the incoming alpha value is not equal to the
reference value.
GLGEQUAL Passes if the incoming alpha value is greater than or
equal to the reference value.
GLALWAYS Always passes.
glAlphaFunc operates on all pixel writes, including those resulting from
the scan conversion of points, lines, polygons, and bitmaps, and from
pixel draw and copy operations. glAlphaFunc does not affect screen clear
operations.
NOTES
Alpha testing is done only in RGBA mode.
ERRORS
GLINVALIDENUM is generated if func is not an accepted value.
GLINVALIDOPERATION is generated if glAlphaFunc is executed between the
execution of glBegin and the corresponding execution of glEnd.
ASSOCIATED GETS
glGet with argument GLALPHATESTFUNC
glGet with argument GLALPHATESTREF
glIsEnabled with argument GLALPHATEST
SEE ALSO
glBlendFunc, glClear, glDepthFunc, glEnable, glStencilFunc
Page 2