glAlphaFunc function
The glAlphaFunc function enables your application to set the alpha test function.
Syntax
void WINAPI glAlphaFunc(
GLenum func,
GLclampf ref
);
Parameters
-
func
-
The alpha comparison function. The following are the accepted symbolic constants and their meanings.
Value Meaning - GL_NEVER
Never passes. - GL_LESS
Passes if the incoming alpha value is less than the reference value. - GL_EQUAL
Passes if the incoming alpha value is equal to the reference value. - GL_LEQUAL
Passes if the incoming alpha value is less than or equal to the reference value. - GL_GREATER
Passes if the incoming alpha value is greater than the reference value. - GL_NOTEQUAL
Passes if the incoming alpha value is not equal to the reference value. - GL_GEQUAL
Passes if the incoming alpha value is greater than or equal to the reference value. - GL_ALWAYS
Always passes. This is the default. -
ref
-
The reference value to which incoming alpha values are compared. 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.
Return value
This function does not return a value.
Error codes
The following error codes can be retrieved by the glGetError function.
Name | Meaning |
---|---|
|
func was not an accepted value. |
|
The function was called between a call to glBegin and the corresponding call to glEnd. |
Remarks
The alpha test discards fragments depending on the outcome of a comparison between the incoming fragments' alpha values and a constant reference value. The glAlphaFunc function specifies the reference and comparison function. The comparison is performed only if alpha testing is enabled. (For more information on GL_ALPHA_TEST, see glEnable.)
The func and ref parameters 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 framebuffer at that pixel location.
The glAlphaFunc function 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. The glAlphaFunc function does not affect screen clear operations.
Alpha testing is done only in RGBA mode.
The following functions retrieve information related to the glAlphaFunc function:
glGet with argument GL_ALPHA_TEST_FUNC
glGet with argument GL_ALPHA_TEST_REF
glIsEnabled with argument GL_ALPHA_TEST
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
Minimum supported server |
Windows 2000 Server [desktop apps only] |
Header |
|
Library |
|
DLL |
|