1GLALPHAFUNC(3G) OpenGL Manual GLALPHAFUNC(3G)
2
3
4
6 glAlphaFunc - specify the alpha test function
7
9 void glAlphaFunc(GLenum func, GLclampf ref);
10
12 func
13 Specifies the alpha comparison function. Symbolic constants
14 GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL,
15 GL_GEQUAL, and GL_ALWAYS are accepted. The initial value is
16 GL_ALWAYS.
17
18 ref
19 Specifies the reference value that incoming alpha values are
20 compared to. This value is clamped to the range 0 1, where 0
21 represents the lowest possible alpha value and 1 the highest
22 possible value. The initial reference value is 0.
23
25 The alpha test discards fragments depending on the outcome of a
26 comparison between an incoming fragment's alpha value and a constant
27 reference value. glAlphaFunc specifies the reference value and the
28 comparison function. The comparison is performed only if alpha testing
29 is enabled. By default, it is not enabled. (See glEnable() and
30 glDisable() of GL_ALPHA_TEST.)
31
32 func and ref specify the conditions under which the pixel is drawn. The
33 incoming alpha value is compared to ref using the function specified by
34 func. If the value passes the comparison, the incoming fragment is
35 drawn if it also passes subsequent stencil and depth buffer tests. If
36 the value fails the comparison, no change is made to the frame buffer
37 at that pixel location. The comparison functions are as follows:
38
39 GL_NEVER
40 Never passes.
41
42 GL_LESS
43 Passes if the incoming alpha value is less than the reference
44 value.
45
46 GL_EQUAL
47 Passes if the incoming alpha value is equal to the reference value.
48
49 GL_LEQUAL
50 Passes if the incoming alpha value is less than or equal to the
51 reference value.
52
53 GL_GREATER
54 Passes if the incoming alpha value is greater than the reference
55 value.
56
57 GL_NOTEQUAL
58 Passes if the incoming alpha value is not equal to the reference
59 value.
60
61 GL_GEQUAL
62 Passes if the incoming alpha value is greater than or equal to the
63 reference value.
64
65 GL_ALWAYS
66 Always passes (initial value).
67
68 glAlphaFunc operates on all pixel write operations, including those
69 resulting from the scan conversion of points, lines, polygons, and
70 bitmaps, and from pixel draw and copy operations. glAlphaFunc does not
71 affect screen clear operations.
72
74 Alpha testing is performed only in RGBA mode.
75
77 GL_INVALID_ENUM is generated if func is not an accepted value.
78
79 GL_INVALID_OPERATION is generated if glAlphaFunc is executed between
80 the execution of glBegin() and the corresponding execution of glEnd().
81
83 glGet() with argument GL_ALPHA_TEST_FUNC
84
85 glGet() with argument GL_ALPHA_TEST_REF
86
87 glIsEnabled() with argument GL_ALPHA_TEST
88
90 glBlendFunc(), glClear(), glDepthFunc(), glEnable(), glStencilFunc()
91
93 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
94 under the SGI Free Software B License. For details, see
95 http://oss.sgi.com/projects/FreeB/.
96
98 opengl.org
99
100
101
102opengl.org 07/13/2018 GLALPHAFUNC(3G)