GL_TESSCOORD(3G)

GL_TESSCOORD(3G) πŸ’…βœ¨

okay so bestie, this page lives in section 3G of the manual (yep, the OpenGL shader-y corner of the world), and it's about one tiny little built-in variable that's honestly kind of iconic once you get what it's doing. let's get into it 🫢


✨ NAME ✨

gl_TessCoord β€” it holds the coordinate of the vertex inside the current patch. that's it, that's the whole vibe. it's giving "your little name tag but for a vertex" πŸŽ€


🌸 DECLARATION 🌸

in vec3 gl_TessCoord ;

(also lmao, the raw source has a stray .SH "DESCRIPTION" roff artifact glued onto the end of that line β€” not us, not our problem, we don't claim it πŸ™ˆ)


πŸ¦‹ DESCRIPTION πŸ¦‹

So this one is only available in the tessellation evaluation language (yes the original spells it "cevaluation", we're moving past it 😭). What gl_TessCoord does is hold a three-component vector β€” those components are u, v, and w β€” and that vector identifies the position of the vertex that the shader is currently processing, relative to the primitive that's being tessellated.

like. the vertex knows where it is in the patch. main character energy fr fr πŸ‘‘


⭐ VERSION SUPPORT ⭐

which GLSL versions actually have this? let's do the vibe check πŸ’€

  • 1.10 β€” - nope
  • 1.20 β€” - nope
  • 1.30 β€” - nope
  • 1.40 β€” - nope
  • 1.50 β€” - nope
  • 3.30 β€” - nope
  • 4.00 β€” βœ” slay, it arrives
  • 4.10 β€” βœ”
  • 4.20 β€” βœ”
  • 4.30 β€” βœ”
  • 4.40 β€” βœ”
  • 4.50 β€” βœ”

so basically: gl_TessCoord shows up starting at OpenGL Shading Language version 4.00, and it stays booked and busy through 4.50. everything before 4.00? not invited to the party πŸ™ˆ


🧚 SEE ALSO 🧚

its little friend group, go say hi:

  • gl_TessLevelOuter()
  • gl_TessLevelInner()
  • gl_PatchVerticesIn()

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/.

Copyright Β© 2011-2014 Khronos Group


ok and that's the whole page πŸ’– no cap, it's short but she's thorough. remember: tessellation eval only, vec3, (u, v, w), and the version table starts at 4.00. periodt ✨

later bestie!! this came from [FIXME: source], dated 08/09/2021 β€” so if anything looks vintage, that's why πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from