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 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. 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_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 β†’ 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 Β© 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 Β© 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