1GLUNURBSCALLBACK(3G) OpenGL Manual GLUNURBSCALLBACK(3G)
2
3
4
6 gluNurbsCallback - define a callback for a NURBS object
7
9 void gluNurbsCallback(GLUnurbs* nurb, GLenum which,
10 _GLUfuncptr CallBackFunc);
11
13 nurb
14 Specifies the NURBS object (created with gluNewNurbsRenderer()).
15
16 which
17 Specifies the callback being defined. Valid values are
18 GLU_NURBS_BEGIN, GLU_NURBS_VERTEX, GLU_NURBS_NORMAL,
19 GLU_NURBS_COLOR, GLU_NURBS_TEXTURE_COORD, GLU_NURBS_END,
20 GLU_NURBS_BEGIN_DATA, GLU_NURBS_VERTEX_DATA, GLU_NURBS_NORMAL_DATA,
21 GLU_NURBS_COLOR_DATA, GLU_NURBS_TEXTURE_COORD_DATA,
22 GLU_NURBS_END_DATA, and GLU_NURBS_ERROR.
23
24 CallBackFunc
25 Specifies the function that the callback calls.
26
28 gluNurbsCallback is used to define a callback to be used by a NURBS
29 object. If the specified callback is already defined, then it is
30 replaced. If CallBackFunc is NULL, then this callback will not get
31 invoked and the related data, if any, will be lost.
32
33 Except the error callback, these callbacks are used by NURBS
34 tessellator (when GLU_NURBS_MODE is set to be GLU_NURBS_TESSELLATOR) to
35 return back the OpenGL polygon primitives resulting from the
36 tessellation. Note that there are two versions of each callback: one
37 with a user data pointer and one without. If both versions for a
38 particular callback are specified then the callback with the user data
39 pointer will be used. Note that ``userData'' is a copy of the pointer
40 that was specified at the last call to gluNurbsCallbackData.
41
42 The error callback function is effective no matter which value that
43 GLU_NURBS_MODE is set to. All other callback functions are effective
44 only when GLU_NURBS_MODE is set to GLU_NURBS_TESSELLATOR.
45
46 The legal callbacks are as follows:
47
48 GLU_NURBS_BEGIN
49
50 The begin callback indicates the start of a primitive. The function
51 takes a single argument of type GLenum, which can be one of
52 GLU_LINES, GLU_LINE_STRIP, GLU_TRIANGLE_FAN, GLU_TRIANGLE_STRIP,
53 GLU_TRIANGLES, or GLU_QUAD_STRIP. The default begin callback
54 function is NULL. The function prototype for this callback looks
55 like:
56
57 void begin( GLenum type );
58
59
60
61 GLU_NURBS_BEGIN_DATA
62
63 The same as the GLU_NURBS_BEGIN callback except that it takes an
64 additional pointer argument. This pointer is a copy of the pointer
65 that was specified at the last call to gluNurbsCallbackData. The
66 default callback function is NULL. The function prototype for this
67 callback function looks like:
68
69 void beginData(GLenum type, void *userData);
70
71
72
73 GLU_NURBS_VERTEX
74
75 The vertex callback indicates a vertex of the primitive. The
76 coordinates of the vertex are stored in the parameter ``vertex''.
77 All the generated vertices have dimension 3; that is, homogeneous
78 coordinates have been transformed into affine coordinates. The
79 default vertex callback function is NULL. The function prototype
80 for this callback function looks like:
81
82 void vertex( GLfloat *vertex );
83
84
85
86 GLU_NURBS_VERTEX_DATA
87
88 This is the same as the GLU_NURBS_VERTEX callback, except that it
89 takes an additional pointer argument. This pointer is a copy of the
90 pointer that was specified at the last call to
91 gluNurbsCallbackData. The default callback function is NULL. The
92 function prototype for this callback function looks like:
93
94 void vertexData( GLfloat *vertex, void *userData );
95
96
97
98 GLU_NURBS_NORMAL
99
100 The normal callback is invoked as the vertex normal is generated.
101 The components of the normal are stored in the parameter
102 ``normal.'' In the case of a NURBS curve, the callback function is
103 effective only when the user provides a normal map
104 (GLU_MAP1_NORMAL). In the case of a NURBS surface, if a normal map
105 (GLU_MAP2_NORMAL) is provided, then the generated normal is
106 computed from the normal map. If a normal map is not provided, then
107 a surface normal is computed in a manner similar to that described
108 for evaluators when GLU_AUTO_NORMAL is enabled. The default normal
109 callback function is NULL. The function prototype for this callback
110 function looks like:
111
112 void normal( GLfloat *normal );
113
114
115
116 GLU_NURBS_NORMAL_DATA
117
118 The same as the GLU_NURBS_NORMAL callback except that it takes an
119 additional pointer argument. This pointer is a copy of the pointer
120 that was specified at the last call to gluNurbsCallbackData. The
121 default callback function is NULL. The function prototype for this
122 callback function looks like:
123
124 void normalData( GLfloat *normal, void *userData );
125
126
127
128 GLU_NURBS_COLOR
129
130 The color callback is invoked as the color of a vertex is
131 generated. The components of the color are stored in the parameter
132 ``color.'' This callback is effective only when the user provides a
133 color map (GLU_MAP1_COLOR_4 or GLU_MAP2_COLOR_4). ``color''
134 contains four components: R, G, B, A. The default color callback
135 function is NULL. The prototype for this callback function looks
136 like:
137
138 void color( GLfloat *color );
139
140
141
142 GLU_NURBS_COLOR_DATA
143
144 The same as the GLU_NURBS_COLOR callback except that it takes an
145 additional pointer argument. This pointer is a copy of the pointer
146 that was specified at the last call to gluNurbsCallbackData. The
147 default callback function is NULL. The function prototype for this
148 callback function looks like:
149
150 void colorData( GLfloat *color, void *userData );
151
152
153
154 GLU_NURBS_TEXTURE_COORD
155
156 The texture callback is invoked as the texture coordinates of a
157 vertex are generated. These coordinates are stored in the parameter
158 ``texCoord.'' The number of texture coordinates can be 1, 2, 3, or
159 4 depending on which type of texture map is specified
160 (GLU_MAP1_TEXTURE_COORD_1, GLU_MAP1_TEXTURE_COORD_2,
161 GLU_MAP1_TEXTURE_COORD_3, GLU_MAP1_TEXTURE_COORD_4,
162 GLU_MAP2_TEXTURE_COORD_1, GLU_MAP2_TEXTURE_COORD_2,
163 GLU_MAP2_TEXTURE_COORD_3, GLU_MAP2_TEXTURE_COORD_4). If no texture
164 map is specified, this callback function will not be called. The
165 default texture callback function is NULL. The function prototype
166 for this callback function looks like:
167
168 void texCoord( GLfloat *texCoord );
169
170
171
172 GLU_NURBS_TEXTURE_COORD_DATA
173
174 This is the same as the GLU_NURBS_TEXTURE_COORD callback, except
175 that it takes an additional pointer argument. This pointer is a
176 copy of the pointer that was specified at the last call to
177 gluNurbsCallbackData. The default callback function is NULL. The
178 function prototype for this callback function looks like:
179
180 void texCoordData( GLfloat *texCoord, void *userData );
181
182
183
184 GLU_NURBS_END
185
186 The end callback is invoked at the end of a primitive. The default
187 end callback function is NULL. The function prototype for this
188 callback function looks like:
189
190 void end( void );
191
192
193
194 GLU_NURBS_END_DATA
195
196 This is the same as the GLU_NURBS_END callback, except that it
197 takes an additional pointer argument. This pointer is a copy of the
198 pointer that was specified at the last call to
199 gluNurbsCallbackData. The default callback function is NULL. The
200 function prototype for this callback function looks like:
201
202 void endData( void *userData );
203
204
205
206 GLU_NURBS_ERROR
207
208 The error function is called when an error is encountered. Its
209 single argument is of type GLenum, and it indicates the specific
210 error that occurred. There are 37 errors unique to NURBS, named
211 GLU_NURBS_ERROR1 through GLU_NURBS_ERROR37. Character strings
212 describing these errors can be retrieved with gluErrorString().
213
215 gluNurbsCallback is available only if the GLU version is 1.2 or
216 greater.
217
218 GLU version 1.2 supports only the GLU_ERROR parameter for which. The
219 GLU_ERROR value is deprecated in GLU version 1.3 in favor of
220 GLU_NURBS_ERROR. All other accepted values for CallBackFunc are
221 available only if the GLU version is 1.3 or greater.
222
224 gluErrorString(), gluNewNurbsRenderer(), gluNurbsCallbackData,
225 gluNurbsProperty()
226
228 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
229 under the SGI Free Software B License. For details, see
230 http://oss.sgi.com/projects/FreeB/.
231
233 opengl.org
234
235
236
237opengl.org 06/10/2014 GLUNURBSCALLBACK(3G)