/ comp / gb.opengl / gl / depthfunc
Gl.DepthFunc (gb.opengl)
Syntax

    STATIC SUB DepthFunc ( Function AS Integer )

### Specify the value used for depth buffer comparisons

#### Parameters

- Function specifies the depth comparison function. Symbolic constants Gl.GL_NEVER, Gl.GL_LESS, Gl.GL_EQUAL, Gl.GL_LEQUAL, Gl.GL_GREATER, Gl.GL_NOTEQUAL, Gl.GL_GEQUAL, and Gl.GL_ALWAYS are accepted. The default value is Gl.GL_LESS.

#### Description

Gl.DepthFunc 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 Gl.Enable and Gl.Disable of Gl.GL_DEPTH_TEST).

Function specifies the conditions under which the pixel will be drawn. The comparison functions are as follows:

- Gl.GL_NEVER never passes.

- Gl.GL_LESS passes if the incoming z value is less than the stored z value.

- Gl.GL_EQUAL passes if the incoming z value is equal to the stored z value.

- Gl.GL_LEQUAL passes if the incoming z value is less than or equal to the stored z value.

- Gl.GL_GREATER passes if the incoming z value is greater than the stored z value.

- Gl.GL_NOTEQUAL passes if the incoming z value is not equal to the stored z value.

- Gl.GL_GEQUAL passes if the incoming z value is greater than or equal to the stored z value.

- Gl.GL_ALWAYS always passes.

The default value of Function is Gl.GL_LESS. Initially, depth testing is disabled.

#### Errors

Gl.GL_INVALID_ENUM is generated if Function is not an accepted value.
Gl.GL_INVALID_OPERATION is generated if Gl.DepthFunc is called between a call to Gl.Begin and the corresponding call to Gl.End.

#### Associated Gets

Gl.GetDepthFunc
Gl.IsEnabled with argument Gl.GL_DEPTH_TEST

### See also

Gl.DepthRange, Gl.Enable