GLLINESTIPPLE(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

✨ GLLINESTIPPLE(3G) ✨

okay bestie, welcome to the GLLINESTIPPLE(3G) page πŸ’– this is the one where we make your lines go dotted. like, actual dashes and gaps in your OpenGL lines. it's giving "graph paper realness" and honestly? iconic.


🌸 NAME 🌸

glLineStipple β€” specify the line stipple pattern


πŸ’… C SPECIFICATION πŸ’…

void glLineStipple( GLint factor,
                    GLushort pattern )

delim $$


πŸŽ€ PARAMETERS πŸŽ€

  • factor β€” the multiplier for each bit in the line stipple pattern, fr fr. so if factor is 3, every single bit in the pattern gets used three times before we move on to the next bit. it's clamped to the range [1, 256] and defaults to 1. periodt.
  • pattern β€” a 16-bit integer, and its bit pattern is what decides which fragments of a line actually get drawn when the line is rasterized. bit zero goes first, and the default pattern is all 1's (so like, everything drawn, no gaps, very demure).

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: line stippling masks out certain fragments that rasterization produces, and those masked fragments just… don't get drawn. no cap. πŸ™ˆ

the masking is done using three parameters: the 16-bit line stipple pattern pattern, the repeat count factor, and an integer stipple counter $s$.

counter $s$ gets reset to 0 whenever glBegin is called, and also before each line segment of a glBegin(GL_LINES)/glEnd sequence is generated. it gets incremented after each fragment of a unit width aliased line segment is generated, or after each $i$ fragments of an $i$ width line segment are generated. the $i$ fragments associated with count $s$ are masked out if

pattern bit $(s ~/~ "factor") ~roman mod~ 16$

is 0. otherwise, bestie, those fragments get sent straight to the frame buffer. πŸ’« and bit zero of pattern is the least significant bit, iykyk.

antialiased lines are treated as a sequence of $1 times width$ rectangles for purposes of stippling. whether rectangle $s$ gets rasterized or not depends on the fragment rule described for aliased lines β€” except you're counting rectangles rather than groups of fragments. the way that works out is lowkey elegant.

to turn line stippling on and off, call glEnable and glDisable with argument GL_LINE_STIPPLE. when it's enabled, the line stipple pattern gets applied exactly as described above. when it's disabled, it's as if the pattern were all 1's. and initially? line stippling is disabled. 😌


πŸ’€ ERRORS πŸ’€

GL_INVALID_OPERATION is generated if glLineStipple is executed between the execution of glBegin and the corresponding execution of glEnd.

not me getting an error because i called it mid-glBegin… don't do that. πŸ™…β€β™€οΈ

⭐ ASSOCIATED GETS ⭐

  • glGet with argument GL_LINE_STIPPLE_PATTERN
  • glGet with argument GL_LINE_STIPPLE_REPEAT
  • glIsEnabled with argument GL_LINE_STIPPLE

🌈 SEE ALSO 🌈

  • glLineWidth(3G)
  • glPolygonStipple(3G)

that's the whole page babes, every last bit of it, no skips 🫢

signing off from the GLLINESTIPPLE(3G) page, repping the 3G manual set β€” stay stippled, stay slay πŸ’œβœ¨

πŸ“¦ where this page comes from