GL_FRONTFACING(3G)

πŸ’… GL_FRONTFACING πŸ’…

okay so bestie, this is the GL_FRONTFACING(3G) page β€” yes, 3G is the manual name, and the header lowkey also says [FIXME: manual], so we're working with what we've got πŸ’–. It's all about whether a primitive is front or back facing, and it's honestly giving graphics-pipeline main character energy ✨.

✨ NAME ✨

gl_FrontFacing β€” indicates whether a primitive is front or back facing. That's the whole vibe of the name, no cap πŸ’….

πŸŽ€ DECLARATION πŸŽ€

in bool gl_FrontFacing ;.SH "DESCRIPTION"

bestie, that stray .SH "DESCRIPTION" is literally glued onto the declaration in the source, and I am not editing it, because facts are facts 🫢.

πŸ’– DESCRIPTION πŸ’–

Available only in the fragment language, gl_FrontFacing is an input variable whose value is true if the fragment belongs to a front-facing primitive and false otherwise. slay, that's the whole point πŸ”₯.

The determination of whether a triangle primitive is front-facing is made by examining the sign of the area of the triangle, including a possible reversal of this sign as controlled by glFrontFace. One way to compute this area is:

a=12 βˆ‘ j=0 n-1 x w i y w i+1 - x w i+1 y w i

where x w i and y w i are the x and y window coordinates of the ith vertex of the n-vertex polygon. keep that exactly as-is, bestie, character for character πŸ’€.

The sign of this computation is negated when the value of GL_CLIP_ORIGIN (the clip volume origin, set with glClipControl()) is GL_UPPER_LEFT. so yeah, flip the vibe when the clip origin is upper-left 🌈.

🌈 VERSION SUPPORT 🌈

Variable name: gl_FrontFacing

OpenGL Shading Language Version β€” gl_FrontFacing is supported with βœ” in every version listed:

  • 1.10 β€” βœ”
  • 1.20 β€” βœ”
  • 1.30 β€” βœ”
  • 1.40 β€” βœ”
  • 1.50 β€” βœ”
  • 3.30 β€” βœ”
  • 4.00 β€” βœ”
  • 4.10 β€” βœ”
  • 4.20 β€” βœ”
  • 4.30 β€” βœ”
  • 4.40 β€” βœ”
  • 4.50 β€” βœ”

πŸ¦‹ SEE ALSO πŸ¦‹

  • gl_FragCoord()
  • glClipControl()

Copyright Β© 2011-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/. periodt πŸ’….

Copyright Β© 2011-2014 Khronos Group. yeah bestie, that's the short one, and we're keeping it too πŸŽ€.


signed off with [FIXME: source], dated 08/09/2021, and stamped GL_FRONTFACING(3G) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from