1GLUNURBSCALLBACK(3G) GLUNURBSCALLBACK(3G)
2
3
4
6 gluNurbsCallback - define a callback for a NURBS object
7
8
10 void gluNurbsCallback( GLUnurbs* nurb,
11 GLenum which,
12 _GLUfuncptr CallBackFunc )
13
14
16 nurb Specifies the NURBS object (created with
17 gluNewNurbsRenderer).
18
19 which Specifies the callback being defined. Valid values are
20 GLU_NURBS_BEGIN, GLU_NURBS_VERTEX, GLU_NURBS_NORMAL,
21 GLU_NURBS_COLOR, GLU_NURBS_TEXTURE_COORD, GLU_NURBS_END,
22 GLU_NURBS_BEGIN_DATA, GLU_NURBS_VERTEX_DATA,
23 GLU_NURBS_NORMAL_DATA, GLU_NURBS_COLOR_DATA,
24 GLU_NURBS_TEXTURE_COORD_DATA, GLU_NURBS_END_DATA, and
25 GLU_NURBS_ERROR.
26
27 CallBackFunc Specifies the function that the callback calls.
28
30 gluNurbsCallback is used to define a callback to be used by a NURBS
31 object. If the specified callback is already defined, then it is
32 replaced. If CallBackFunc is NULL, then this callback will not get
33 invoked and the related data, if any, will be lost.
34
35 Except the error callback, these callbacks are used by NURBS tessella‐
36 tor (when GLU_NURBS_MODE is set to be GLU_NURBS_TESSELLATOR) to return
37 back the OpenGL polygon primitives resulting from the tessellation.
38 Note that there are two versions of each callback: one with a user data
39 pointer and one without. If both versions for a particular callback are
40 specified then the callback with the user data pointer will be used.
41 Note that ``userData'' is a copy of the pointer that was specified at
42 the last call to gluNurbsCallbackData.
43
44 The error callback function is effective no matter which value that
45 GLU_NURBS_MODE is set to. All other callback functions are effective
46 only when GLU_NURBS_MODE is set to GLU_NURBS_TESSELLATOR.
47
48 The legal callbacks are as follows:
49
50 GLU_NURBS_BEGIN
51 The begin callback indicates the start of a primitive. The
52 function takes a single argument of type GLenum, which can be
53 one of GL_LINES, GL_LINE_STRIP, GL_TRIANGLE_FAN,
54 GL_TRIANGLE_STRIP, GL_TRIANGLES, or GL_QUAD_STRIP. The
55 default begin callback function is NULL. The function proto‐
56 type for this callback looks like:
57 void begin ( GLenum type );
58
59 GLU_NURBS_BEGIN_DATA
60 The same as the GLU_NURBS_BEGIN callback except that it takes
61 an additional pointer argument. This pointer is a copy of the
62 pointer that was specified at the last call to
63 gluNurbsCallbackData. The default callback function is NULL.
64 The function prototype for this callback function looks like:
65 void beginData (GLenum type, void *userData);
66
67 GLU_NURBS_VERTEX
68 The vertex callback indicates a vertex of the primitive. The
69 coordinates of the vertex are stored in the parameter ``ver‐
70 tex''. All the generated vertices have dimension 3, that is,
71 homogeneous coordinates have been transformed into affine
72 coordinates. The default vertex callback function is NULL.
73 The function prototype for this callback function looks like:
74 void vertex ( GLfloat *vertex );
75
76 GLU_NURBS_VERTEX_DATA
77 This is the same as the GLU_NURBS_VERTEX callback, except
78 that it takes an additional pointer argument. This pointer is
79 a copy of the pointer that was specified at the last call to
80 gluNurbsCallbackData. The default callback function is NULL.
81 The function prototype for this callback function looks like:
82 void vertexData ( GLfloat *vertex, void *userData );
83
84 GLU_NURBS_NORMAL
85 The normal callback is invoked as the vertex normal is gener‐
86 ated. The components of the normal are stored in the parame‐
87 ter ``normal''. In the case of a NURBS curve, the callback
88 function is effective only when the user provides a normal
89 map (GL_MAP1_NORMAL). In the case of a NURBS surface, if a
90 normal map (GL_MAP2_NORMAL) is provided, then the generated
91 normal is computed from the normal map. If a normal map is
92 not provided then a surface normal is computed in a manner
93 similar to that described for evaluators when GL_AUTO_NORMAL
94 is enabled.
95 The default normal callback function is NULL. The function
96 prototype for this callback function looks like:
97 void normal ( GLfloat *normal );
98
99 GLU_NURBS_NORMAL_DATA
100 The same as the GLU_NURBS_NORMAL callback except that it
101 takes an additional pointer argument. This pointer is a copy
102 of the pointer that was specified at the last call to
103 gluNurbsCallbackData. The default callback function is NULL.
104 The function prototype for this callback function looks like:
105 void normalData ( GLfloat *normal, void *userData );
106
107 GLU_NURBS_COLOR
108 The color callback is invoked as the color of a vertex is
109 generated. The components of the color are stored in the
110 parameter ``color''. This callback is effective only when
111 the user provides a color map (GL_MAP1_COLOR_4 or
112 GL_MAP2_COLOR_4). ``color'' contains four components:
113 R,G,B,A. The default color callback function is NULL. The
114 prototype for this callback function looks like:
115 void color ( GLfloat *color );
116
117 GLU_NURBS_COLOR_DATA
118 The same as the GLU_NURBS_COLOR callback except that it takes
119 an additional pointer argument. This pointer is a copy of the
120 pointer that was specified at the last call to
121 gluNurbsCallbackData. The default callback function is NULL.
122 The function prototype for this callback function looks like:
123 void colorData ( GLfloat *color, void *userData );
124
125 GLU_NURBS_TEXTURE_COORD
126 The texture callback is invoked as the texture coordinates of
127 a vertex are generated. These coordinates are stored in the
128 parameter ``texCoord''. The number of texture coordinates can
129 be 1, 2, 3, or 4 depending on which type of texture map is
130 specified (GL_MAP1_TEXTURE_COORD_1, GL_MAP1_TEXTURE_COORD_2,
131 GL_MAP1_TEXTURE_COORD_3, GL_MAP1_TEXTURE_COORD_4,
132 GL_MAP2_TEXTURE_COORD_1, GL_MAP2_TEXTURE_COORD_2,
133 GL_MAP2_TEXTURE_COORD_3, GL_MAP2_TEXTURE_COORD_4). If no
134 texture map is specified, this callback function will not be
135 called.
136 The default texture callback function is NULL. The function
137 prototype for this callback function looks like:
138 void texCoord ( GLfloat *texCoord );
139
140 GLU_NURBS_TEXTURE_COORD_DATA
141 This is the same as the GLU_NURBS_TEXTURE_COORD callback,
142 except that it takes an additional pointer argument. This
143 pointer is a copy of the pointer that was specified at the
144 last call to gluNurbsCallbackData. The default callback
145 function is NULL. The function prototype for this callback
146 function looks like:
147 void texCoordData (GLfloat *texCoord, void *userData);
148
149 GLU_NURBS_END
150 The end callback is invoked at the end of a primitive. The
151 default end callback function is NULL. The function prototype
152 for this callback function looks like:
153 void end ( void );
154
155 GLU_NURBS_END_DATA
156 This is the same as the GLU_NURBS_END callback, except that
157 it takes an additional pointer argument. This pointer is a
158 copy of the pointer that was specified at the last call to
159 gluNurbsCallbackData. The default callback function is NULL.
160 The function prototype for this callback function looks like:
161 void endData ( void *userData );
162
163 GLU_NURBS_ERROR
164 The error function is called when an error is encountered.
165 Its single argument is of type GLenum, and it indicates the
166 specific error that occurred. There are 37 errors unique to
167 NURBS named GLU_NURBS_ERROR1 through GLU_NURBS_ERROR37.
168 Character strings describing these errors can be retrieved
169 with gluErrorString.
170
172 gluNurbsCallback is available only if the GLU version is 1.2 or
173 greater.
174
175 GLU version 1.2 supports only the GLU_ERROR parameter for which. The
176 GLU_ERROR value is deprecated in GLU version 1.3 in favor of
177 GLU_NURBS_ERROR. All other accepted values for CallBackFunc are avail‐
178 able only if the GLU version is 1.3 or greater.
179
181 gluErrorString(3G), gluNewNurbsRenderer(3G), gluNurbsCallbackData(3G),
182 gluNurbsProperty(3G)
183
184
185
186
187 GLUNURBSCALLBACK(3G)