The alpha function is used to discard fragments based upon a comparison of the fragment's alpha value with a reference value. The comparison function and the reference value are specified with the command glAlphaFunc(). The alpha test is enabled with glEnableGL_ALPHA_TEST(GL_ALPHA_TEST).
The alpha test is frequently used to draw complicated geometry using texture maps on polygons. For example, a tree can be drawn as a picture of a tree on a single rectangle. The parts of the texture which are part of the tree have an alpha value of 1; parts of the texture which are not part of the tree have an alpha value of 0. This technique is often combined with billboarding (Section 6.10), in which a rectangle is turned to perpetually face the eye point.
Like polygon stippling, the alpha function discards fragments instead of drawing them into the framebuffer. Therefore sorting of the primitives is not necessary (unless some other mode like alpha blending is enabled). The disadvantage is that pixels must be completely opaque or completely transparent.