Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The glDepthFunc function specifies the value used for depth-buffer comparisons.
void glDepthFunc(
GLenum func);
Symbolic Constant | Meaning |
---|---|
GL_NEVER | Never passes. |
GL_LESS | Passes if the incoming z value is less than the stored z value. This is the default value. |
GL_LEQUAL | Passes if the incoming z value is less than or equal to the stored z value. |
GL_EQUAL | Passes if the incoming z value is equal to the stored z value. |
GL_GREATER | Passes if the incoming z value is greater than the stored z value. |
GL_NOTEQUAL | Passes if the incoming z value is not equal to the stored z value. |
GL_GEQUAL | Passes if the incoming z value is greater than or equal to the stored z value. |
GL_ALWAYS | Always passes. |
The glDepthFunc function specifies the function used to compare each incoming pixel z value with the z value present in the depth buffer. The comparison is performed only if depth testing is enabled. (See glEnable with the argument GL_DEPTH_TEST.)
Initially, depth testing is disabled.
The following functions retrieve information related to glDepthFunc:
glGet with argument GL_DEPTH_FUNC
glIsEnabled with argument GL_DEPTH_TEST
The following are the error codes generated and their conditions.
Error code | Condition |
---|---|
GL_INVALID_ENUM | func was not an accepted value. |
GL_INVALID_OPERATION | glDepthFunc was called between a call to glBegin and the corresponding call to glEnd. |
** Windows NT/2000:** Requires Windows NT 3.5 or later.
** Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
** Header:** Declared in Gl.h.
** Library:** Use Opengl32.lib.
Please sign in to use this experience.
Sign in