The glClearDepth function specifies the clear value for the depth buffer.

void glClearDepth(
  GLclampd depth


The depth value used when the depth buffer is cleared.


The glClearDepth function specifies the depth value used by glClear to clear the depth buffer. Values specified by glClearDepth are clamped to the range [0,1].

The following function retrieves information related to the glClearDepth function:

glGet with argument GL_DEPTH_CLEAR_VALUE

Error Codes

The following is the error code generated and its condition.

Error code Condition
GL_INVALID_OPERATION glClearDepth 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.

See Also

glBegin, glClear, glEnd, glGet


Community Additions