GLUTESSPROPERTY(3G)

πŸ“¦ version 1.1, in centos-stream 9, fedora 43, fedora 44

πŸ’… GLUTESSPROPERTY β€” okay bestie, let's set some tessellation properties

So this is gluTessProperty, from the 3G manual, and honestly? She's the one who decides how your polygons get interpreted. Main character energy fr. 🌸


✨ C SPECIFICATION ✨

void gluTessProperty( GLUtesselator* tess,
                      GLenum which,
                      GLdouble data )

πŸŽ€ PARAMETERS πŸŽ€

  • tess β€” the tessellation object you're poking at. You made it with gluNewTess, remember? πŸ‘‘
  • which β€” which property you wanna set. The valid values are GLU_TESS_WINDING_RULE, GLU_TESS_BOUNDARY_ONLY, and GLU_TESS_TOLERANCE. That's the whole list, no extras, periodt.
  • data β€” the actual value you're assigning to that property. That's it, that's the vibe.

🌈 DESCRIPTION 🌈

gluTessProperty controls the properties living inside a tessellation object. These properties are literally the ones that change how your polygons get interpreted and rendered. So like… pretty important. πŸ’–

The legal values for which are, one by one:

πŸŒ€ GLU_TESS_WINDING_RULE

This one decides which parts of the polygon count as the "interior". data can be set to GLU_TESS_WINDING_ODD, GLU_TESS_WINDING_NONZERO, GLU_TESS_WINDING_POSITIVE, GLU_TESS_WINDING_NEGATIVE, or GLU_TESS_WINDING_ABS_GEQ_TWO.

Not me about to explain winding numbers, but okay, here we go, because it's actually kind of iconic:

Think of your input contours as partitioning the whole plane into regions. The winding rule is what tells you which of those regions are inside the polygon. πŸ¦‹

For a single contour C, the winding number of a point x is just the signed number of revolutions you make around x as you travel once around C β€” and CCW counts as positive. When you've got several contours, you sum up their individual winding numbers. This whole procedure hands every point x in the plane a signed integer. And note: every point in the same region gets the same winding number. That's the key detail.

The winding rule then classifies a region as "inside" if its winding number falls into the chosen category β€” odd, nonzero, positive, negative, or absolute value of at least two.

The old GLU tessellator (pre-GLU 1.2, ancient history bestie) used the "odd" rule. "nonzero" is another super common way to define the interior. And the other three rules? Those are the ones you want for polygon CSG operations. πŸ”₯

🚧 GLU_TESS_BOUNDARY_ONLY

This is a boolean, so data should be GL_TRUE or GL_FALSE. When you set it to GL_TRUE, instead of a tessellation you get back a set of closed contours separating the polygon interior from the exterior. Exterior contours are oriented CCW with respect to the normal; interior contours are oriented CW. And the GLU_TESS_BEGIN and GLU_TESS_BEGIN_DATA callbacks use the type GL_LINE_LOOP for each contour. Slay. ✨

πŸ“ GLU_TESS_TOLERANCE

This sets a tolerance for merging features, which shrinks your output size. Like, two vertices sitting super close together might get replaced by one single vertex. The tolerance gets multiplied by the largest coordinate magnitude of any input vertex, and that gives you the maximum distance any feature can move from a single merge operation. Heads up though: if one feature takes part in several merges, the total distance it moves could end up larger. πŸ™ˆ

Feature merging is completely optional β€” the tolerance is only a hint. The implementation is free to merge in some cases and not others, or to just never merge anything at all. The initial tolerance is 0.

Also, real talk, the current implementation only merges vertices if they're exactly coincident, no matter what the current tolerance says. A vertex gets spliced into an edge only when the implementation can't tell which side of the edge that vertex is on. And two edges only merge when both their endpoints are identical. That's the whole story, no cap. πŸ’€

Ngl, don't assume the tolerance does more than it says. It's a hint, not a promise. 🫢

πŸ‘€ SEE ALSO πŸ‘€

  • gluGetTessProperty(3G)
  • gluNewTess(3G)

And that's the page, bestie. πŸ’œ This was GLUTESSPROPERTY(3G) β€” yes, the same name top and bottom, she's consistent like that β€” from the 3G manual section. Go forth and tessellate responsibly. 🧚🌟

πŸ“¦ where this page comes from