GLCLIPCONTROL(3G)
π GLCLIPCONTROL(3G) π
okay so this is GLCLIPCONTROL(3G), aka the 3G manual page for glClipControl β and yes, the header literally says [FIXME: manual], but we move π
. No cap, this one is about clip control origin and depth mode.
β¨ NAME β¨
glClipControl β control clip coordinate to window coordinate behavior. that's the whole name, and it's giving coordinate transformation main character energy.
π οΈ C SPECIFICATION π οΈ
void glClipControl(GLenum origin, GLenum depth);
ποΈ PARAMETERS ποΈ
originβ specifies the clip control origin. Must be one ofGL_LOWER_LEFTorGL_UPPER_LEFT.depthβ specifies the clip control depth mode. Must be one ofGL_NEGATIVE_ONE_TO_ONEorGL_ZERO_TO_ONE.
π« DESCRIPTION π«
glClipControl controls the clipping volume behavior and the clip coordinate to window coordinate transformation behavior. like it literally sets the rules for how clipping and window coords behave.
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. so yes, the sign flip is real.
π 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 http://www.opengl.org/registry/. iykyk, go read the registry if you want the deep lore.
π¨ ERRORS π¨
- An
GL_INVALID_ENUMerror is generated iforiginis notGL_LOWER_LEFTorGL_UPPER_LEFT. - An
GL_INVALID_ENUMerror is generated ifdepthis notGL_NEGATIVE_ONE_TO_ONEorGL_ZERO_TO_ONE.
π VERSION SUPPORT π
OpenGL Version β glClipControl support (Function / Feature Name: glClipControl):
2.0:-2.1:-3.0:-3.1:-3.2:-3.3:-4.0:-4.1:-4.2:-4.3:-4.4:-4.5:β
π SEE ALSO π
gl_ClipDistance(), gl_CullDistance(), gl_FrontFacing(), glDepthRange().
Β©οΈ COPYRIGHT Β©οΈ
Copyright Β© 2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
Β©οΈ COPYRIGHT Β©οΈ
Copyright Β© 2014 Khronos Group
that's the whole page, bestie π β signed off with [FIXME: source], dated 08/09/2021, and stamped GLCLIPCONTROL(3G). periodt. π
β¨
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms