1GLUTESSVERTEX(3G) GLUTESSVERTEX(3G)
2
3
4
6 gluTessVertex - specify a vertex on a polygon
7
8
10 void gluTessVertex( GLUtesselator* tess,
11 GLdouble *location,
12 GLvoid* data )
13
14
16 tess Specifies the tessellation object (created with gluNewTess).
17
18 location Specifies the location of the vertex.
19
20 data Specifies an opaque pointer passed back to the program with
21 the vertex callback (as specified by gluTessCallback).
22
24 gluTessVertex describes a vertex on a polygon that the program defines.
25 Successive gluTessVertex calls describe a closed contour. For example,
26 to describe a quadrilateral gluTessVertex should be called four times.
27 gluTessVertex can only be called between gluTessBeginContour and
28 gluTessEndContour.
29
30 data normally points to a structure containing the vertex location, as
31 well as other per-vertex attributes such as color and normal. This
32 pointer is passed back to the user through the GLU_TESS_VERTEX or
33 GLU_TESS_VERTEX_DATA callback after tessellation (see the
34 gluTessCallback reference page).
35
37 A quadrilateral with a triangular hole in it can be described as fol‐
38 lows:
39
40 gluTessBeginPolygon(tobj, NULL);
41 gluTessBeginContour(tobj);
42 gluTessVertex(tobj, v1, v1);
43 gluTessVertex(tobj, v2, v2);
44 gluTessVertex(tobj, v3, v3);
45 gluTessVertex(tobj, v4, v4);
46 gluTessEndContour(tobj);
47 gluTessBeginContour(tobj);
48 gluTessVertex(tobj, v5, v5);
49 gluTessVertex(tobj, v6, v6);
50 gluTessVertex(tobj, v7, v7);
51 gluTessEndContour(tobj); gluTessEndPolygon(tobj);
52
53
55 It is a common error to use a local variable for location or data and
56 store values into it as part of a loop. For example: for (i = 0; i <
57 NVERTICES; ++i) {
58 GLdouble data[3];
59 data[0] = vertex[i][0];
60 data[1] = vertex[i][1];
61 data[2] = vertex[i][2];
62 gluTessVertex(tobj, data, data);
63 }
64
65 This doesn't work. Because the pointers specified by location and data
66 might not be dereferenced until gluTessEndPolygon is executed, all the
67 vertex coordinates but the very last set could be overwritten before
68 tessellation begins.
69
70 Two common symptoms of this problem are consists of a single point
71 (when a local variable is used for data) and a
72 GLU_TESS_NEED_COMBINE_CALLBACK error (when a local variable is used for
73 location).
74
76 gluTessBeginPolygon(3G), gluNewTess(3G), gluTessBeginContour(3G),
77 gluTessCallback(3G), gluTessProperty(3G), gluTessNormal(3G),
78 gluTessEndPolygon(3G)
79
80
81
82
83
84 GLUTESSVERTEX(3G)