1GLDEPTHFUNC(3G) OpenGL Manual GLDEPTHFUNC(3G)
2
3
4
6 glDepthFunc - specify the value used for depth buffer comparisons
7
9 void glDepthFunc(GLenum func);
10
12 func
13 Specifies the depth 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_LESS.
17
19 glDepthFunc specifies the function used to compare each incoming pixel
20 depth value with the depth value present in the depth buffer. The
21 comparison is performed only if depth testing is enabled. (See
22 glEnable() and glDisable() of GL_DEPTH_TEST.)
23
24 func specifies the conditions under which the pixel will be drawn. The
25 comparison functions are as follows:
26
27 GL_NEVER
28 Never passes.
29
30 GL_LESS
31 Passes if the incoming depth value is less than the stored depth
32 value.
33
34 GL_EQUAL
35 Passes if the incoming depth value is equal to the stored depth
36 value.
37
38 GL_LEQUAL
39 Passes if the incoming depth value is less than or equal to the
40 stored depth value.
41
42 GL_GREATER
43 Passes if the incoming depth value is greater than the stored depth
44 value.
45
46 GL_NOTEQUAL
47 Passes if the incoming depth value is not equal to the stored depth
48 value.
49
50 GL_GEQUAL
51 Passes if the incoming depth value is greater than or equal to the
52 stored depth value.
53
54 GL_ALWAYS
55 Always passes.
56
57 The initial value of func is GL_LESS. Initially, depth testing is
58 disabled. If depth testing is disabled or if no depth buffer exists, it
59 is as if the depth test always passes.
60
62 Even if the depth buffer exists and the depth mask is non-zero, the
63 depth buffer is not updated if the depth test is disabled. In order to
64 unconditionally write to the depth buffer, the depth test should be
65 enabled and set to GL_ALWAYS.
66
68 GL_INVALID_ENUM is generated if func is not an accepted value.
69
71 glGet() with argument GL_DEPTH_FUNC
72
73 glIsEnabled() with argument GL_DEPTH_TEST
74
76 glDepthRange(), glEnable(), glPolygonOffset()
77
79 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
80 under the SGI Free Software B License. For details, see
81 http://oss.sgi.com/projects/FreeB/.
82
84 opengl.org
85
86
87
88opengl.org 06/10/2014 GLDEPTHFUNC(3G)