GL_POINTSIZE(3G)

πŸ’… gl_PointSize β€” the GL_POINTSIZE(3G) glow-up

okay so bestie, welcome to GL_POINTSIZE(3G) β€” yes that's the manual section, she's fancy. this little icon is all about gl_PointSize, which literally contains the size of rasterized points, in pixels. that's her whole job. slay.


✨ NAME ✨

gl_PointSize β€” contains size of rasterized points, in pixels πŸŽ€


🌸 DECLARATION 🌸

so gl_PointSize is a member of the gl_PerVertex named block β€” she does not roll solo, she's part of a clique. here's the whole squad, copy-pasted exactly, no cap:

out gl_PerVertex {
    vec4 gl_Position;
    float gl_PointSize;
    float gl_ClipDistance[];
};

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so in the vertex, tessellation evaluation and geometry languages, there's a single global instance of the gl_PerVertex named block just vibing there, and its gl_PointSize member is an output that receives the intended size of the point to be rasterized, in pixels. she's the main character of point sizing, honestly. you can write to her at any time during shader execution β€” no schedule, no appointment, just go off whenever. πŸ’…

here's the catch though, and it's giving plot twist: if GL_PROGRAM_POINT_SIZE is enabled, gl_PointSize is used to determine the size of rasterized points. otherwise? she's literally ignored by the rasterization stage. ignored. ghosted. 😭

now in the tessellation control language, the gl_PerVertex named block is used to construct an array, gl_out[], whose members become available as inputs to the subsequent tessellation evaluation shader. so the whole block becomes an array β€” yes the entire squad, not just her.

and now the chaotic part, hold on: the value of gl_PointSize (or the gl_PointSize member of the gl_out[] array, in the case of the tessellation control shader) is undefined after the vertex, tessellation control, and tessellation evaluation shading stages if the corresponding shader executable does not write to gl_PointSize. undefined!! 🫠

it's also undefined after the geometry processing stage if the geometry shader executable calls EmitVertex() without having written gl_PointSize since the last call to EmitVertex() (or hasn't written it at all). so like... write her before you emit, bestie. that's the whole rule. write before you emit.

lastly, in the tessellation control, tessellation evaluation and geometry languages, the gl_PerVertex named block is used to construct an array, gl_in[] of per-vertex or per-control point inputs whose content represents the corresponding outputs written by the previous stage. pipeline stages really be passing notes in class. πŸ’Œ


πŸ”₯ VERSION SUPPORT πŸ”₯

the original page has a whole big grid of OpenGL Shading Language versions (1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50) β€” we don't do tables here so let's break it down by stage instead πŸ’–

gl_PointSize (vertex shader) 🌈

available in every single version, she's been here since the beginning:

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

gl_PointSize (geometry shader) πŸ‘‘

showed up late but she showed up:

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

gl_PointSize (tessellation evaluation shader) 🧚

even later, but honestly worth the wait:

  • 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 πŸ“

go say hi to her friends, they're iconic too:

  • gl_Position()
  • gl_ClipDistance()

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


okay that's the whole page, you ate that ngl πŸ’…βœ¨ this lil beauty comes to you from [FIXME: source], dated 08/09/2021 β€” and yes, GL_POINTSIZE(3G) is still her name, no notes. mwah πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from