GLUBEGINPOLYGON(3G)

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

πŸ’… GLUBEGINPOLYGON β€” bestie's guide to delimiting a polygon description ✨

okay so this is the tea on gluBeginPolygon and gluEndPolygon from the 3G manual, and honestly? they're a whole dynamic duo 🫢. they're the little "start here" and "ok we're done" brackets that wrap around a polygon definition. iconic behavior, no cap.


🌸 NAME 🌸

gluBeginPolygon, gluEndPolygon β€” delimit a polygon description πŸ’–

so basically they bracket a polygon. that's the whole vibe. that's the job.


✨ C SPECIFICATION ✨

lowkey the signatures are giving very straightforward:

void gluBeginPolygon( GLUtesselator* tess )

void gluEndPolygon( GLUtesselator* tess )

πŸŽ€ PARAMETERS πŸŽ€

  • tess β€” specifies the tessellation object, and bestie, you make that thing with gluNewTess. no tess, no polygon, that's the rule πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the situation. gluBeginPolygon and gluEndPolygon delimit the definition of a nonconvex polygon. nonconvex!! the complicated ones!! the ones that don't just chill in a simple shape!! 🌈

to define one of those, you do this little sequence, in order, no skipping steps:

  1. first, call gluBeginPolygon β€” this is you opening the group chat πŸ’¬
  2. then define the contours of the polygon by calling gluTessVertex for each vertex (yes, every single one, don't be lazy) and gluNextContour to start each new contour 🌸
  3. finally, call gluEndPolygon to signal that the definition is over. periodt. βœ‹

if you want more deets, go read the gluTessVertex and gluNextContour reference pages, they've got the lore πŸ“–

once gluEndPolygon gets called, the polygon is tessellated, and the resulting triangles are described through callbacks. callbacks!! the little functions that come back and tell you what happened 🫢 if you want the descriptions of the callback functions, that's a gluTessCallback situation, go check that page.


⚠️ NOTES ⚠️

ok real talk bestie. this command is obsolete and it's provided for backward compatibility only. it's giving "still in the group chat but doesn't talk anymore" πŸ’€

here's exactly how the mapping works, because this matters:

  • calls to gluBeginPolygon are mapped to gluTessBeginPolygon followed by gluTessBeginContour
  • calls to gluEndPolygon are mapped to gluTessEndContour followed by gluTessEndPolygon

so like, if you're writing new code, you probably want the gluTess* versions. but if you're dealing with old code, now you know what's happening under the hood 🧚


πŸ’– EXAMPLE πŸ’–

a quadrilateral with a triangular hole in it can be described like this β€” and honestly, a quad with a lil triangular hole? adorable. ate. πŸ‘‘

gluBeginPolygon(tobj);
   gluTessVertex(tobj, v1, v1);
   gluTessVertex(tobj, v2, v2);
   gluTessVertex(tobj, v3, v3);
   gluTessVertex(tobj, v4, v4); gluNextContour(tobj, GLU_INTERIOR);
   gluTessVertex(tobj, v5, v5);
   gluTessVertex(tobj, v6, v6);
   gluTessVertex(tobj, v7, v7); gluEndPolygon(tobj);

see how the first contour is v1 through v4, then gluNextContour(tobj, GLU_INTERIOR) starts the hole, and v5 through v7 fill in the triangle? that's the move. that's the whole trick 🌟


πŸ‘€ SEE ALSO πŸ‘€

go read these next, they're all part of the same friend group:

  • gluNewTess(3G)
  • gluNextContour(3G)
  • gluTessCallback(3G)
  • gluTessVertex(3G)
  • gluTessBeginPolygon(3G)
  • gluTessBeginContour(3G)

part 1 done, and there's more coming so don't go anywhere bestie 🫢✨

πŸ’… DESCRIPTION πŸ’…

okay bestie, so gluBeginPolygon and gluEndPolygon are the little matching bookends that delimit the definition of a nonconvex polygon. fr fr, that's the whole job.

to define one of these polygons, here's the lil ritual:

  1. first call gluBeginPolygon β€” that's you opening the door πŸšͺ
  2. then define the contours of the polygon by calling gluTessVertex for each vertex, and gluNextContour to start each new contour
  3. finally call gluEndPolygon to signal that the definition is done, periodt ✨

want the deets? go peek at the gluTessVertex and gluNextContour reference pages, they got you covered.

once gluEndPolygon gets called, the polygon is tessellated πŸ‘‘ and the resulting triangles get described through callbacks. see gluTessCallback for descriptions of the callback functions β€” that's where the magic actually happens, iykyk.


🌸 NOTES 🌸

bestie. listen. πŸ’€

this command is obsolete and is provided for backward compatibility only. it's giving legacy, it's giving "we keep it around for the old heads."

here's exactly how the mapping goes, no cap:

  • calls to gluBeginPolygon are mapped to gluTessBeginPolygon followed by gluTessBeginContour
  • calls to gluEndPolygon are mapped to gluTessEndContour followed by gluTessEndPolygon

that's it, that's the tea β˜•


✨ EXAMPLE ✨

a quadrilateral with a triangular hole in it can be described like this:

gluBeginPolygon(tobj);
   gluTessVertex(tobj, v1, v1);
   gluTessVertex(tobj, v2, v2);
   gluTessVertex(tobj, v3, v3);
   gluTessVertex(tobj, v4, v4); gluNextContour(tobj, GLU_INTERIOR);
   gluTessVertex(tobj, v5, v5);
   gluTessVertex(tobj, v6, v6);
   gluTessVertex(tobj, v7, v7); gluEndPolygon(tobj);

look at that. a whole quadrilateral with a hole, four verts for the outside, three for the inside, and GLU_INTERIOR doing the absolute most to say "this next bit is the hole." iconic behavior honestly πŸ•³οΈπŸ’–


πŸ¦‹ SEE ALSO πŸ¦‹

  • gluNewTess(3G)
  • gluNextContour(3G)
  • gluTessCallback(3G)
  • gluTessVertex(3G)
  • gluTessBeginPolygon(3G)
  • gluTessBeginContour(3G)

and that's a wrap on GLUBEGINPOLYGON(3G), bestie πŸŽ€ this lil page lives in the GLU section of the manual (section 3G, the graphics girlies' floor), and the footer at the bottom of the page just says the page name right back at you β€” GLUBEGINPOLYGON(3G) β€” which, okay, kind of a slay that it's self-titled. go tessellate something gorgeous. no cap. πŸ’œπŸ«Ά

πŸ“¦ where this page comes from