GLUTESSVERTEX(3G)
π
GLUTESSVERTEX β the 3G page, bestie edition π
okay so this is gluTessVertex(3G) from the GLU crew, and it's literally the lil function that tells your tessellator "hey girl, here's a corner of my polygon" β¨
πΈ NAME πΈ
gluTessVertex β specify a vertex on a polygon
β¨ C SPECIFICATION β¨
void gluTessVertex( GLUtesselator* tess,
GLdouble *location,
GLvoid* data )
π«Ά PARAMETERS π«Ά
tessβ the tessellation object you made earlier withgluNewTess. your main character, basically πlocationβ where the vertex actually is in space. its location, iconic of it π«dataβ an opaque pointer that gets handed right back to your program through the vertex callback (the one you set up withgluTessCallback). like a little note you pass to future-you π
π DESCRIPTION π
so gluTessVertex describes a vertex on a polygon that your program defines. every time you call it, you're adding another corner. successive gluTessVertex calls describe a closed contour β like, a whole loop. wanna describe a quadrilateral? call gluTessVertex four times, boom, done, ate π
lowkey important:gluTessVertexcan only be called betweengluTessBeginContourandgluTessEndContour. no sneaking it in anywhere else, bestie π«
and about data β normally it points to a structure that holds the vertex location plus all the other per-vertex glow-up details like color and normal. that pointer gets passed back to you through the GLU_TESS_VERTEX or GLU_TESS_VERTEX_DATA callback after tessellation happens (go read the gluTessCallback reference page for the tea, iykyk).
π EXAMPLE π
say you want a quadrilateral with a triangular hole in it. it's giving donut. it's giving very demure. here's how you'd describe it:
gluTessBeginPolygon(tobj, NULL);
gluTessBeginContour(tobj);
gluTessVertex(tobj, v1, v1);
gluTessVertex(tobj, v2, v2);
gluTessVertex(tobj, v3, v3);
gluTessVertex(tobj, v4, v4);
gluTessEndContour(tobj);
gluTessBeginContour(tobj);
gluTessVertex(tobj, v5, v5);
gluTessVertex(tobj, v6, v6);
gluTessVertex(tobj, v7, v7);
gluTessEndContour(tobj); gluTessEndPolygon(tobj);
β οΈ NOTES β οΈ
okay this next part is the part where everyone gets humbled, so listen up fr fr π
it is a very common error to use a local variable for location or data and then stuff values into it inside a loop. like this:
for (i = 0; i < NVERTICES; ++i) {
GLdouble data[3];
data[0] = vertex[i][0];
data[1] = vertex[i][1];
data[2] = vertex[i][2];
gluTessVertex(tobj, data, data);
}
this does not work. not a vibe. not it. π
here's why: the pointers you hand over as location and data might not get dereferenced until gluTessEndPolygon actually runs. so every single set of vertex coordinates except the very last one can get overwritten before tessellation even begins. your poor little stack variable is living on borrowed time π«
two common symptoms of this problem are:
- the result consists of a single point (this is what you get when a local variable is used for
data), and - a
GLU_TESS_NEED_COMBINE_CALLBACKerror (this is what you get when a local variable is used forlocation).
so yeah. don't do that. allocate properly, bestie π§
π SEE ALSO π
gluTessBeginPolygon(3G)gluNewTess(3G)gluTessBeginContour(3G)gluTessCallback(3G)gluTessProperty(3G)gluTessNormal(3G)gluTessEndPolygon(3G)
and that's the whole page, gorgeous π this lil slice of 3G manual realness goes out under the name GLUTESSVERTEX(3G) β that's the source/version tag and the date stamp on the footer, so if you ever need to cite it, that's your girl. go tessellate something iconic, ily, bye π¦β¨
π¦ 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