GLUNEXTCONTOUR(3G)

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

✨ GLUNEXTCONTOUR ✨

okay bestie, so this is a page from the 3G manual β€” GLU land, the OpenGL Utility library πŸ’… β€” and it's all about gluNextContour, aka "new contour, who dis?" πŸ¦‹


🌸 NAME 🌸

gluNextContour β€” mark the beginning of another contour πŸŽ€


πŸ’œ C SPECIFICATION πŸ’œ

void gluNextContour( GLUtesselator* tess,
                     GLenum type )

🫢 PARAMETERS 🫢

  • tess β€” the tessellation object, the one you made with gluNewTess. that's your lil guy, your main character 🫧
  • type β€” what kind of contour you're about to define. the valid values are GLU_EXTERIOR, GLU_INTERIOR, GLU_UNKNOWN, GLU_CCW, and GLU_CW. pick one, no wrong answers (well, technically there are wrong answers, and they're the ones not on that list 😭)

🌈 DESCRIPTION 🌈

gluNextContour is how you describe polygons that have multiple contours β€” the multi-contour moment, if you will ✨

the flow is: you describe your first contour with a whole series of gluTessVertex calls. then you hit it with a gluNextContour call, which is basically the library equivalent of saying "okay that one's done, next!!" β€” it says the previous contour is complete and the next one is about to begin. then you do another series of gluTessVertex calls to describe the new contour. repeat until all your contours are described. it's giving assembly line, it's giving pipeline πŸ‘‘

type is what tells it what type of contour comes next. the legal contour types are:

  • GLU_EXTERIOR β€” an exterior contour defines an exterior boundary of the polygon. the outer edge, the perimeter, the ~vibe boundary~ πŸ’«
  • GLU_INTERIOR β€” an interior contour defines an interior boundary of the polygon (such as a hole). yes bestie, holes count as boundaries too πŸ™ˆ
  • GLU_UNKNOWN β€” an unknown contour gets analyzed by the library to figure out whether it's interior or exterior. it'll just, like, look at it and decide 🧚
  • GLU_CCW, GLU_CW β€” the first GLU_CCW or GLU_CW contour you define is considered to be exterior. all the other contours are considered exterior if they're oriented in the same direction (clockwise or counterclockwise) as that first contour, and interior if they're not. orientation-based, lowkey genius ⭐
heads up: if one contour is of type GLU_CCW or GLU_CW, then all contours must be of the same type. if they are not, then all GLU_CCW and GLU_CW contours will be changed to GLU_UNKNOWN. so like, pick a lane 🚨

also, fun fact: there is no real difference between the GLU_CCW and GLU_CW contour types. they're the same thing wearing different outfits πŸ’€

before the first contour is described, you can call gluNextContour to define the type of the first contour. and if you don't call gluNextContour before that first contour, then the first contour is marked GLU_EXTERIOR by default. no pressure either way πŸ“

🚨 obsolete alert 🚨 this command is obsolete and is provided for backward compatibility only. calls to gluNextContour are mapped to gluTessEndContour followed by gluTessBeginContour. so it still works, it's just an icon living in the past πŸ‘‘

πŸŽ€ EXAMPLE πŸŽ€

say you want a quadrilateral with a triangular hole in it. iconic shape. here's how you'd describe it:

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 gluNextContour(tobj, GLU_INTERIOR) is just chillin' there at the end of the outer four vertices, right before the hole's three vertices start? that's the whole trick ✨


πŸ’– SEE ALSO πŸ’–

gluBeginPolygon(3G), gluNewTess(3G), gluTessCallback(3G), gluTessVertex(3G), gluTessBeginContour(3G)


and that's the whole page, bestie 🫢 this was GLUNEXTCONTOUR(3G) from the GLUNEXTCONTOUR(3G) manual β€” go forth and tessellate, you absolute legend πŸ‘‘πŸ’…

πŸ“¦ where this page comes from