Home / comp / gb.opengl / gl / alphafunc 
Gl.AlphaFunc (gb.opengl)
Syntax
STATIC SUB AlphaFunc ( Function AS Integer, Reference AS Float )

Specify the alpha test function

Parameters

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. 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:

AlphaFunc 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. AlphaFunc does not affect screen clear operations.

Alpha testing is done only in RGBA mode.

Errors

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.

Associated Gets

Gl.GetAlphaTestFunc
Gl.GetAlphaTestRef
Gl.IsEnabled with argument Gl.GL_ALPHA_TEST


See also
Gl.BlendFunc , Gl.Clear , Gl.DepthFunc , Gl.Enable , Gl.StencilFunc