Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> | |
4 | <refentry id="gluTessVertex"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>gluTessVertex</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>gluTessVertex</refname> | |
17 | <refpurpose>specify a vertex on a polygon</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>gluTessVertex</function></funcdef> | |
23 | <paramdef>GLUtesselator* <parameter>tess</parameter></paramdef> | |
24 | <paramdef>GLdouble * <parameter>location</parameter></paramdef> | |
25 | <paramdef>GLvoid* <parameter>data</parameter></paramdef> | |
26 | </funcprototype> | |
27 | </funcsynopsis> | |
28 | </refsynopsisdiv> | |
29 | <!-- eqn: ignoring delim $$ --> | |
30 | <refsect1 id="parameters"><title>Parameters</title> | |
31 | <variablelist> | |
32 | <varlistentry> | |
33 | <term><parameter>tess</parameter></term> | |
34 | <listitem> | |
35 | <para> | |
36 | Specifies the tessellation object (created with <citerefentry><refentrytitle>gluNewTess</refentrytitle></citerefentry>). | |
37 | </para> | |
38 | </listitem> | |
39 | </varlistentry> | |
40 | <varlistentry> | |
41 | <term><parameter>location</parameter></term> | |
42 | <listitem> | |
43 | <para> | |
44 | Specifies the location of the vertex. | |
45 | </para> | |
46 | </listitem> | |
47 | </varlistentry> | |
48 | <varlistentry> | |
49 | <term><parameter>data</parameter></term> | |
50 | <listitem> | |
51 | <para> | |
52 | Specifies an opaque pointer passed back to the program with the vertex callback | |
53 | (as specified by <citerefentry><refentrytitle>gluTessCallback</refentrytitle></citerefentry>). | |
54 | </para> | |
55 | </listitem> | |
56 | </varlistentry> | |
57 | </variablelist> | |
58 | </refsect1> | |
59 | <refsect1 id="description"><title>Description</title> | |
60 | <para> | |
61 | <function>gluTessVertex</function> describes a vertex on a polygon that the program defines. Successive | |
62 | <function>gluTessVertex</function> calls describe a closed contour. For example, | |
63 | to describe a quadrilateral, <function>gluTessVertex</function> should be called four times. | |
64 | <function>gluTessVertex</function> can only be called between <citerefentry><refentrytitle>gluTessBeginContour</refentrytitle></citerefentry> and | |
65 | <citerefentry><refentrytitle>gluTessEndContour</refentrytitle></citerefentry>. | |
66 | </para> | |
67 | <para> | |
68 | <parameter>data</parameter> normally points to a structure containing the vertex | |
69 | location, as well as other per-vertex attributes such as color and normal. | |
70 | This pointer is passed back to the user through the <constant>GLU_TESS_VERTEX</constant> | |
71 | or <constant>GLU_TESS_VERTEX_DATA</constant> callback after tessellation | |
72 | (see the <citerefentry><refentrytitle>gluTessCallback</refentrytitle></citerefentry> reference page). | |
73 | </para> | |
74 | </refsect1> | |
75 | <refsect1 id="example"><title>Example</title> | |
76 | <para> | |
77 | A quadrilateral with a triangular hole in it can be described as follows: | |
78 | <programlisting> | |
79 | gluTessBeginPolygon(tobj, NULL); | |
80 | gluTessBeginContour(tobj); | |
81 | gluTessVertex(tobj, v1, v1); | |
82 | gluTessVertex(tobj, v2, v2); | |
83 | gluTessVertex(tobj, v3, v3); | |
84 | gluTessVertex(tobj, v4, v4); | |
85 | gluTessEndContour(tobj); | |
86 | gluTessBeginContour(tobj); | |
87 | gluTessVertex(tobj, v5, v5); | |
88 | gluTessVertex(tobj, v6, v6); | |
89 | gluTessVertex(tobj, v7, v7); | |
90 | gluTessEndContour(tobj); | |
91 | gluTessEndPolygon(tobj); | |
92 | </programlisting> | |
93 | </para> | |
94 | </refsect1> | |
95 | <refsect1 id="notes"><title>Notes</title> | |
96 | <para> | |
97 | It is a common error to use a local variable for <parameter>location</parameter> or <parameter>data</parameter> and store | |
98 | values into it as part of a loop. | |
99 | For example: | |
100 | <programlisting> | |
101 | for (i = 0; i < NVERTICES; ++i) { | |
102 | GLdouble data[3]; | |
103 | data[0] = vertex[i][0]; | |
104 | data[1] = vertex[i][1]; | |
105 | data[2] = vertex[i][2]; | |
106 | gluTessVertex(tobj, data, data); | |
107 | } | |
108 | </programlisting> | |
109 | </para> | |
110 | <para> | |
111 | This doesn't work. | |
112 | Because the pointers specified by <parameter>location</parameter> and <parameter>data</parameter> might not be | |
113 | dereferenced until <citerefentry><refentrytitle>gluTessEndPolygon</refentrytitle></citerefentry> is executed, | |
114 | all the vertex coordinates but the very last set could be overwritten | |
115 | before tessellation begins. | |
116 | </para> | |
117 | <para> | |
118 | Two common symptoms of this problem are when the data consists of a single | |
119 | point (when a local variable is used for <parameter>data</parameter>) and a | |
120 | <constant>GLU_TESS_NEED_COMBINE_CALLBACK</constant> error (when a local variable is | |
121 | used for <parameter>location</parameter>). | |
122 | </para> | |
123 | </refsect1> | |
124 | <refsect1 id="seealso"><title>See Also</title> | |
125 | <para> | |
126 | <citerefentry><refentrytitle>gluNewTess</refentrytitle></citerefentry>, | |
127 | <citerefentry><refentrytitle>gluTessBeginContour</refentrytitle></citerefentry>, | |
128 | <citerefentry><refentrytitle>gluTessBeginPolygon</refentrytitle></citerefentry>, | |
129 | <citerefentry><refentrytitle>gluTessCallback</refentrytitle></citerefentry>, | |
130 | <citerefentry><refentrytitle>gluTessEndPolygon</refentrytitle></citerefentry>, | |
131 | <citerefentry><refentrytitle>gluTessNormal</refentrytitle></citerefentry>, | |
132 | <citerefentry><refentrytitle>gluTessProperty</refentrytitle></citerefentry> | |
133 | </para> | |
134 | </refsect1> | |
135 | <refsect1 id="Copyright"><title>Copyright</title> | |
136 | <para> | |
137 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
138 | Silicon Graphics, Inc. This document is licensed under the SGI | |
139 | Free Software B License. For details, see | |
140 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
141 | </para> | |
142 | </refsect1> | |
143 | </refentry> |