1GLDEPTHFUNC(3G) GLDEPTHFUNC(3G)
2
3
4
6 glDepthFunc - specify the value used for depth buffer comparisons
7
8
10 void glDepthFunc( GLenum func )
11
12
14 func Specifies the depth comparison function. Symbolic constants
15 GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL,
16 GL_GEQUAL, and GL_ALWAYS are accepted. The initial value is
17 GL_LESS.
18
20 glDepthFunc specifies the function used to compare each incoming pixel
21 depth value with the depth value present in the depth buffer. The com‐
22 parison is performed only if depth testing is enabled. (See glEnable
23 and glDisable of GL_DEPTH_TEST.)
24
25 func specifies the conditions under which the pixel will be drawn. The
26 comparison functions are as follows:
27
28 GL_NEVER Never passes.
29
30 GL_LESS Passes if the incoming depth value is less than the
31 stored depth value.
32
33 GL_EQUAL Passes if the incoming depth value is equal to the
34 stored depth value.
35
36 GL_LEQUAL Passes if the incoming depth value is less than or
37 equal to the stored depth value.
38
39 GL_GREATER Passes if the incoming depth value is greater than the
40 stored depth value.
41
42 GL_NOTEQUAL Passes if the incoming depth value is not equal to the
43 stored depth value.
44
45 GL_GEQUAL Passes if the incoming depth value is greater than or
46 equal to the stored depth value.
47
48 GL_ALWAYS Always passes.
49
50 The initial value of func is GL_LESS. Initially, depth testing is dis‐
51 abled. Even if the depth buffer exists and the depth mask is non-zero,
52 the depth buffer is not updated if the depth test is disabled.
53
55 GL_INVALID_ENUM is generated if func is not an accepted value.
56
57 GL_INVALID_OPERATION is generated if glDepthFunc is executed between
58 the execution of glBegin and the corresponding execution of glEnd.
59
61 glGet with argument GL_DEPTH_FUNC
62 glIsEnabled with argument GL_DEPTH_TEST
63
65 glDepthRange(3G), glEnable(3G), glPolygonOffset(3G)
66
67
68
69 GLDEPTHFUNC(3G)