Light | Dark

glClipControl

Name

glClipControl — control clip coordinate to window coordinate behavior

C Specification

void glClipControl( GLenum origin,
  GLenum depth);
 

Parameters

origin

Specifies the clip control origin. Must be one of GL_LOWER_LEFT or GL_UPPER_LEFT.

depth

Specifies the clip control depth mode. Must be one of GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE.

Description

glClipControl controls the clipping volume behavior and the clip coordinate to window coordinate transformation behavior.

The view volume is defined by $$z_{min} \leq z_c \leq w_c$$ where $z_{min} = -w_c$ when depth is GL_NEGATIVE_ONE_TO_ONE, and $z_{min} = 0$ when depth is GL_ZERO_TO_ONE.

The normalized device coordinate $y_d$ is given by $$y_d = { { f \times y_c } \over w_c }$$ where $f = 1$ when origin is GL_LOWER_LEFT, and $f = -1$ when origin is GL_UPPER_LEFT.

The window coordinate $z_w$ is given by $$z_w = s \times z_d + b$$ where $s = { { f - n } \over 2 }$ and $b = { {n + f} \over 2 }$ when depth is GL_NEGATIVE_ONE_TO_ONE, and $s = f - n$ and $b = n$ when depth is GL_ZERO_TO_ONE. $n$ and $f$ are the near and far depth range values set with glDepthRange.

Finally, the polygon area computation defined by gl_FrontFacing to determine if a polygon is front- or back-facing has its sign negated when origin is GL_UPPER_LEFT.

Notes

The default GL clip volume definition is for a origin of GL_LOWER_LEFT and a depth of GL_NEGATIVE_ONE_TO_ONE.

An origin of GL_UPPER_LEFT and a depth of GL_ZERO_TO_ONE corresponds to Direct3D's clip volume definition.

An origin of GL_UPPER_LEFT and a depth of GL_NEGATIVE_ONE_TO_ONE corresponds to the upper-left origin of the window coordinate system of Microsoft Windows and the X Window System.

There is extensive discussion of the uses and further consequences of the different clip volume settings in the GL_ARB_clip_control extension specification in the OpenGL Registry at URL https://www.opengl.org/registry/.

Errors

An GL_INVALID_ENUM error is generated if origin is not GL_LOWER_LEFT or GL_UPPER_LEFT.

An GL_INVALID_ENUM error is generated if depth is not GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE.

Version Support

OpenGL Version
Function / Feature Name 2.0 2.1 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3 4.4 4.5
glClipControl - - - - - - - - - - -
Think you can improve this page? Edit this page on GitHub.