/ comp / gb.opengl / gl / depthrange
Gl.DepthRange (gb.opengl)
Syntax

    STATIC SUB DepthRange ( Near AS Float, Far AS Float )

### Specify the mapping of z values from normalized device coordinates to window coordinates

#### Parameters

- Near specifies the mapping of the near clipping plane to window coordinates. The default value is 0.

- Far specifies the mapping of the far clipping plane to window coordinates. The default value is 1.

#### Description

After clipping and division by w, z coordinates range from -1.0 to 1.0, corresponding to the near and far clipping planes. Gl.DepthRange specifies a linear mapping of the normalized z coordinates in this range to window z coordinates. Regardless of the actual depth buffer implementation, window coordinate depth values are treated as though they range from 0.0 through 1.0 (like color components). Thus, the values accepted by Gl.DepthRange are both clamped to this range before they are accepted.

The default mapping of 0, 1 maps the near plane to 0 and the far plane to 1. With this mapping, the depth buffer range is fully utilized.

| It is not necessary, that Near be less than Far. Reverse mappings such as 1, 0 are acceptable.

#### Errors

Gl.GL_INVALID_OPERATION is generated if Gl.DepthRange is called between a call to Gl.Begin and the corresponding call to Gl.End.

#### Associated Gets

Gl.GetDepthRange

### See also

Gl.DepthFunc , Gl.Viewport