STATIC SUB AlphaFunc ( Function AS Integer, Reference AS Float )
The alpha test discards fragments depending on the outcome of a comparison between the incoming fragment's alpha value and a constant reference value. AlphaFunc specifies the reference and comparison function. The comparison is performed only if alpha testing is enabled. (See Gl.Enable and Gl.Disable of Gl.GL_ALPHA_TEST.)
Function and Reference specify the conditions under which the pixel is drawn. The incoming alpha value is compared to Reference using the function specified by Function. 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:
![]() | Alpha testing is done only in RGBA mode. |
Gl.GL_INVALID_ENUM is generated if Function is not an accepted value.
Gl.GL_INVALID_OPERATION is generated if AlphaFunc is called between a call to Gl.Begin and the corresponding call to Gl.End.
Gl.GetAlphaTestFunc
Gl.GetAlphaTestRef
Gl.IsEnabled with argument Gl.GL_ALPHA_TEST