Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>gluNurbsCallback</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="gluNurbsCallback"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gluNurbsCallback — define a callback for a NURBS object</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">gluNurbsCallback</b>(</code></td><td>GLUnurbs* </td><td><var class="pdparam">nurb</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">which</var>, </td></tr><tr><td> </td><td>_GLUfuncptr </td><td><var class="pdparam">CallBackFunc</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>nurb</code></em></span></dt><dd><p> | |
4 | Specifies the NURBS object (created with <a class="citerefentry" href="gluNewNurbsRenderer.xml"><span class="citerefentry"><span class="refentrytitle">gluNewNurbsRenderer</span></span></a>). | |
5 | </p></dd><dt><span class="term"><em class="parameter"><code>which</code></em></span></dt><dd><p> | |
6 | Specifies the callback being defined. | |
7 | Valid values are <code class="constant">GLU_NURBS_BEGIN</code>, <code class="constant">GLU_NURBS_VERTEX</code>, <code class="constant">GLU_NURBS_NORMAL</code>, <code class="constant">GLU_NURBS_COLOR</code>, <code class="constant">GLU_NURBS_TEXTURE_COORD</code>, <code class="constant">GLU_NURBS_END</code>, <code class="constant">GLU_NURBS_BEGIN_DATA</code>, <code class="constant">GLU_NURBS_VERTEX_DATA</code>, <code class="constant">GLU_NURBS_NORMAL_DATA</code>, <code class="constant">GLU_NURBS_COLOR_DATA</code>, <code class="constant">GLU_NURBS_TEXTURE_COORD_DATA</code>, <code class="constant">GLU_NURBS_END_DATA</code>, and <code class="constant">GLU_NURBS_ERROR</code>. | |
8 | </p></dd><dt><span class="term"><em class="parameter"><code>CallBackFunc</code></em></span></dt><dd><p> | |
9 | Specifies the function that the callback calls. | |
10 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
11 | <code class="function">gluNurbsCallback</code> is used to define a callback to be used by a NURBS | |
12 | object. | |
13 | If the specified callback is already defined, then it is replaced. If | |
14 | <em class="parameter"><code>CallBackFunc</code></em> is NULL, then this callback will not get | |
15 | invoked and the related data, if any, will be lost. | |
16 | </p><p> | |
17 | Except the error callback, these callbacks are used by NURBS tessellator (when <code class="constant">GLU_NURBS_MODE</code> is set to be <code class="constant">GLU_NURBS_TESSELLATOR</code>) to return back the OpenGL | |
18 | polygon primitives resulting from the tessellation. Note that there are two | |
19 | versions of each callback: one with a user data pointer and one without. If both versions for a particular callback are specified then the callback with | |
20 | the user data pointer will be used. Note that ``userData'' is a copy of the pointer that was specified at the last call to <code class="function">gluNurbsCallbackData</code>. | |
21 | </p><p> | |
22 | The error callback function is effective no matter which value that | |
23 | <code class="constant">GLU_NURBS_MODE</code> is set to. | |
24 | All other callback functions are effective only when <code class="constant">GLU_NURBS_MODE</code> | |
25 | is set to <code class="constant">GLU_NURBS_TESSELLATOR</code>. | |
26 | </p><p> | |
27 | The legal callbacks are as follows: | |
28 | </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GLU_NURBS_BEGIN</code></span></dt><dd><p> | |
29 | </p><p> | |
30 | The begin callback indicates the start of a primitive. The function | |
31 | takes a single argument of type GLenum, which can be one of | |
32 | <code class="constant">GLU_LINES</code>, <code class="constant">GLU_LINE_STRIP</code>, <code class="constant">GLU_TRIANGLE_FAN</code>, <code class="constant">GLU_TRIANGLE_STRIP</code>, <code class="constant">GLU_TRIANGLES</code>, or <code class="constant">GLU_QUAD_STRIP</code>. The | |
33 | default begin callback function is NULL. The function prototype | |
34 | for this callback looks like: | |
35 | </p><pre class="programlisting"> | |
36 | void begin( GLenum type ); | |
37 | </pre><p> | |
38 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_BEGIN_DATA</code></span></dt><dd><p> | |
39 | </p><p> | |
40 | The same as the <code class="constant">GLU_NURBS_BEGIN</code> callback except that it takes an | |
41 | additional pointer argument. This pointer is a copy of the pointer that | |
42 | was specified at the last call to <code class="function">gluNurbsCallbackData</code>. The | |
43 | default callback function is NULL. The function prototype for this | |
44 | callback function looks like: | |
45 | </p><pre class="programlisting"> | |
46 | void beginData(GLenum type, void *userData); | |
47 | </pre><p> | |
48 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_VERTEX</code></span></dt><dd><p> | |
49 | </p><p> | |
50 | The vertex callback indicates a vertex of the primitive. The | |
51 | coordinates of the vertex are stored in the parameter ``vertex''. All | |
52 | the generated vertices have dimension 3; that is, homogeneous | |
53 | coordinates have been transformed into affine coordinates. The default | |
54 | vertex callback function is NULL. The function prototype for this | |
55 | callback function looks like: | |
56 | </p><pre class="programlisting"> | |
57 | void vertex( GLfloat *vertex ); | |
58 | </pre><p> | |
59 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_VERTEX_DATA</code></span></dt><dd><p> | |
60 | </p><p> | |
61 | This is the same as the <code class="constant">GLU_NURBS_VERTEX</code> callback, except that | |
62 | it takes an additional pointer argument. This pointer is a copy of the | |
63 | pointer that was specified at the last call to | |
64 | <code class="function">gluNurbsCallbackData</code>. The default callback function is NULL. The | |
65 | function prototype for this callback function looks like: | |
66 | </p><pre class="programlisting"> | |
67 | void vertexData( GLfloat *vertex, void *userData ); | |
68 | </pre><p> | |
69 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_NORMAL</code></span></dt><dd><p> | |
70 | </p><p> | |
71 | The normal callback is invoked as the vertex normal is generated. | |
72 | The components of the normal are stored in the parameter ``normal.'' | |
73 | In the case of a NURBS curve, the callback function is effective only when | |
74 | the user provides a normal map (<code class="constant">GLU_MAP1_NORMAL</code>). | |
75 | In the case of a NURBS surface, if a normal map (<code class="constant">GLU_MAP2_NORMAL</code>) | |
76 | is provided, then the generated normal is computed from the normal map. | |
77 | If a normal map is not provided, then a surface normal is computed in | |
78 | a manner similar to that described for evaluators when <code class="constant">GLU_AUTO_NORMAL</code> | |
79 | is enabled. | |
80 | The default normal callback function is NULL. The function | |
81 | prototype for this callback function looks like: | |
82 | </p><pre class="programlisting"> | |
83 | void normal( GLfloat *normal ); | |
84 | </pre><p> | |
85 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_NORMAL_DATA</code></span></dt><dd><p> | |
86 | </p><p> | |
87 | The same as the <code class="constant">GLU_NURBS_NORMAL</code> callback except that it | |
88 | takes an additional pointer argument. This pointer is a copy of the pointer | |
89 | that was specified at the last call to <code class="function">gluNurbsCallbackData</code>. The default callback function is NULL. The function prototype for this callback function looks like: | |
90 | </p><pre class="programlisting"> | |
91 | void normalData( GLfloat *normal, void *userData ); | |
92 | </pre><p> | |
93 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_COLOR</code></span></dt><dd><p> | |
94 | </p><p> | |
95 | The color callback is invoked as the color of a vertex is generated. | |
96 | The components of the color are stored in the parameter ``color.'' | |
97 | This callback is effective only when the user provides a color map | |
98 | (<code class="constant">GLU_MAP1_COLOR_4</code> or <code class="constant">GLU_MAP2_COLOR_4</code>). ``color'' contains four | |
99 | components: R, G, B, A. The default color callback function is NULL. | |
100 | The prototype for this callback function looks like: | |
101 | </p><pre class="programlisting"> | |
102 | void color( GLfloat *color ); | |
103 | </pre><p> | |
104 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_COLOR_DATA</code></span></dt><dd><p> | |
105 | </p><p> | |
106 | The same as the <code class="constant">GLU_NURBS_COLOR</code> callback except that it | |
107 | takes an additional pointer argument. This pointer is a copy of the pointer | |
108 | that was specified at the last call to <code class="function">gluNurbsCallbackData</code>. The default callback function is NULL. The function prototype for this callback function looks like: | |
109 | </p><pre class="programlisting"> | |
110 | void colorData( GLfloat *color, void *userData ); | |
111 | </pre><p> | |
112 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_TEXTURE_COORD</code></span></dt><dd><p> | |
113 | </p><p> | |
114 | The texture callback is invoked as the texture coordinates | |
115 | of a vertex are generated. These coordinates are stored in the parameter | |
116 | ``texCoord.'' The number of texture coordinates can be 1, 2, 3, or 4 depending | |
117 | on which type of texture map is specified | |
118 | (<code class="constant">GLU_MAP1_TEXTURE_COORD_1</code>, | |
119 | <code class="constant">GLU_MAP1_TEXTURE_COORD_2</code>, | |
120 | <code class="constant">GLU_MAP1_TEXTURE_COORD_3</code>, | |
121 | <code class="constant">GLU_MAP1_TEXTURE_COORD_4</code>, | |
122 | <code class="constant">GLU_MAP2_TEXTURE_COORD_1</code>, | |
123 | <code class="constant">GLU_MAP2_TEXTURE_COORD_2</code>, | |
124 | <code class="constant">GLU_MAP2_TEXTURE_COORD_3</code>, | |
125 | <code class="constant">GLU_MAP2_TEXTURE_COORD_4</code>). | |
126 | If no texture map is specified, this callback function will not be called. | |
127 | The default texture callback function is NULL. The function prototype | |
128 | for this callback function looks like: | |
129 | </p><pre class="programlisting"> | |
130 | void texCoord( GLfloat *texCoord ); | |
131 | </pre><p> | |
132 | </p></dd><dt><span class="term"> <code class="constant">GLU_NURBS_TEXTURE_COORD_DATA</code></span></dt><dd><p> | |
133 | </p><p> | |
134 | This is the same as the <code class="constant">GLU_NURBS_TEXTURE_COORD</code> callback, except that it | |
135 | takes an additional pointer argument. This pointer is a copy of the pointer | |
136 | that was specified at the last call to <code class="function">gluNurbsCallbackData</code>. The default callback function is NULL. The function prototype for this callback function looks like: | |
137 | </p><pre class="programlisting"> | |
138 | void texCoordData( GLfloat *texCoord, void *userData ); | |
139 | </pre><p> | |
140 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_END</code></span></dt><dd><p> | |
141 | </p><p> | |
142 | The end callback is invoked at the end of a primitive. The default end callback function is NULL. The function prototype for this callback function looks like: | |
143 | </p><pre class="programlisting"> | |
144 | void end( void ); | |
145 | </pre><p> | |
146 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_END_DATA</code></span></dt><dd><p> | |
147 | </p><p> | |
148 | This is the same as the <code class="constant">GLU_NURBS_END</code> callback, except that it | |
149 | takes an additional pointer argument. This pointer is a copy of the pointer | |
150 | that was specified at the last call to <code class="function">gluNurbsCallbackData</code>. The default callback function is NULL. The function prototype for this callback function looks like: | |
151 | </p><pre class="programlisting"> | |
152 | void endData( void *userData ); | |
153 | </pre><p> | |
154 | </p></dd><dt><span class="term"><code class="constant">GLU_NURBS_ERROR</code></span></dt><dd><p> | |
155 | </p><p> | |
156 | The error function is called when an error is encountered. | |
157 | Its single argument | |
158 | is of type GLenum, and it indicates the specific error that occurred. | |
159 | There are 37 errors unique to NURBS, named | |
160 | <code class="constant">GLU_NURBS_ERROR1</code> through <code class="constant">GLU_NURBS_ERROR37</code>. | |
161 | Character strings describing these errors can be retrieved with | |
162 | <a class="citerefentry" href="gluErrorString.xml"><span class="citerefentry"><span class="refentrytitle">gluErrorString</span></span></a>. | |
163 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
164 | <code class="function">gluNurbsCallback</code> is available only if the GLU version is 1.2 or greater. | |
165 | </p><p> | |
166 | GLU version 1.2 supports only the <code class="constant">GLU_ERROR</code> parameter for | |
167 | <em class="parameter"><code>which</code></em>. The <code class="constant">GLU_ERROR</code> value is deprecated in GLU version 1.3 in | |
168 | favor of <code class="constant">GLU_NURBS_ERROR</code>. All other accepted values for <em class="parameter"><code>CallBackFunc</code></em> | |
169 | are available only if the GLU version is 1.3 or greater. | |
170 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
171 | <a class="citerefentry" href="gluErrorString.xml"><span class="citerefentry"><span class="refentrytitle">gluErrorString</span></span></a>, | |
172 | <a class="citerefentry" href="gluNewNurbsRenderer.xml"><span class="citerefentry"><span class="refentrytitle">gluNewNurbsRenderer</span></span></a>, | |
173 | <code class="function">gluNurbsCallbackData</code>, | |
174 | <a class="citerefentry" href="gluNurbsProperty.xml"><span class="citerefentry"><span class="refentrytitle">gluNurbsProperty</span></span></a> | |
175 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
176 | Copyright <span class="trademark"></span>© 1991-2006 | |
177 | Silicon Graphics, Inc. This document is licensed under the SGI | |
178 | Free Software B License. For details, see | |
179 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
180 | </p></div></div></body></html> |