Previous: glDeleteTextures Table of Contents (GL) Next: glDepthMask

glDepthFunc

specify the value used for depth buffer comparisons

Signature

glDepthFunc( GLenum ( func ) )-> void
glDepthFunc( func )
glDepthFunc( GLenum(func) ) -> None

Parameters

VariablesDescription
func
Specifies the depth comparison function. Symbolic constants GL_NEVER , GL_LESS , GL_EQUAL , GL_LEQUAL , GL_GREATER , GL_NOTEQUAL , GL_GEQUAL , and GL_ALWAYS are accepted. The initial value is GL_LESS .

Description

glDepthFunc specifies the function used to compare each incoming pixel depth value with the depth value present in the depth buffer. The comparison is performed only if depth testing is enabled. (See glEnable and glDisable of GL_DEPTH_TEST .)
func specifies the conditions under which the pixel will be drawn. The comparison functions are as follows:
GL_NEVER
Never passes.
GL_LESS
Passes if the incoming depth value is less than the stored depth value.
GL_EQUAL
Passes if the incoming depth value is equal to the stored depth value.
GL_LEQUAL
Passes if the incoming depth value is less than or equal to the stored depth value.
GL_GREATER
Passes if the incoming depth value is greater than the stored depth value.
GL_NOTEQUAL
Passes if the incoming depth value is not equal to the stored depth value.
GL_GEQUAL
Passes if the incoming depth value is greater than or equal to the stored depth value.
GL_ALWAYS
Always passes.
The initial value of func is GL_LESS . Initially, depth testing is disabled. If depth testing is disabled or if no depth buffer exists, it is as if the depth test always passes.

Notes

Even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled.

Errors

GL_INVALID_ENUM is generated if func is not an accepted value.
GL_INVALID_OPERATION is generated if glDepthFunc is executed between the execution of glBegin and the corresponding execution of glEnd .

Associated Gets

glGet with argument GL_DEPTH_FUNC
glIsEnabled with argument GL_DEPTH_TEST

See Also

Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glDepthFunc
OpenGLContext OpenGLContext/shadow/passes.py Lines: 127, 230, 311, 347
OpenGLContext OpenGLContext/passes/flat.py Lines: 266
OpenGLContext OpenGLContext/passes/rendervisitor.py Lines: 339
OpenGL-Demo PyOpenGL-Demo/tom/conechecker.py Lines: 51
OpenGL-Demo PyOpenGL-Demo/tom/cone.py Lines: 30
OpenGL-Demo PyOpenGL-Demo/tom/fog.py Lines: 49
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson26.py Lines: 56
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson11.py Lines: 33
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson18.py Lines: 115
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson45.py Lines: 358
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson19.py Lines: 89
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson41.py Lines: 181
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson16.py Lines: 51
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson4.py Lines: 66
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson42.py Lines: 170
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson2.py Lines: 56
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson12.py Lines: 36
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson13.py Lines: 119
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson23.py Lines: 60
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson5.py Lines: 69
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson3.py Lines: 56
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson1.py Lines: 56
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6.py Lines: 91
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6-multi.py Lines: 125
OpenGL-Demo PyOpenGL-Demo/GLUT/shader_test.py Lines: 27
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/cone.py Lines: 48
{Artistic License} PymmLib applications/glutviewer.py Lines: 184
{Artistic License} PymmLib mmLib/OpenGLDriver.py Lines: 158
pyBzEdit pyBzEdit.py Lines: 405
{LGPL} Pyggel pyggel/view.py Lines: 166
{LGPL} pygl2d pygl2d/window.py Lines: 64
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/Display3D.py Lines: 137
{LGPL or GPL or MPL} Kamaelia Sketches/THF/3D/playground/Display3D.py Lines: 146
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Kamaelia/UI/OpenGL/OpenGLDisplay.py Lines: 461
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/Display3D.py Lines: 137
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/THF/Sketches/playground/Display3D.py Lines: 146
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Cubes.py Lines: 65
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Spheres.py Lines: 42
{LGPL or GPL or MPL} Kamaelia Code/Python/Kamaelia/Kamaelia/UI/OpenGL/OpenGLDisplay.py Lines: 461
Previous: glDeleteTextures Table of Contents (GL) Next: glDepthMask