GLUBEGINPOLYGON(3G)
π 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 withgluNewTess. 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:
- first, call
gluBeginPolygonβ this is you opening the group chat π¬ - then define the contours of the polygon by calling
gluTessVertexfor each vertex (yes, every single one, don't be lazy) andgluNextContourto start each new contour πΈ - finally, call
gluEndPolygonto 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
gluBeginPolygonare mapped togluTessBeginPolygonfollowed bygluTessBeginContour - calls to
gluEndPolygonare mapped togluTessEndContourfollowed bygluTessEndPolygon
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:
- first call
gluBeginPolygonβ that's you opening the door πͺ - then define the contours of the polygon by calling
gluTessVertexfor each vertex, andgluNextContourto start each new contour - finally call
gluEndPolygonto 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
gluBeginPolygonare mapped togluTessBeginPolygonfollowed bygluTessBeginContour - calls to
gluEndPolygonare mapped togluTessEndContourfollowed bygluTessEndPolygon
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
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms