• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2        EXT_nurbs_tessellator
3
4Name Strings
5
6        GLU_EXT_nurbs_tessellator
7
8Version
9
10        Date: 1996/04/19
11
12Number
13
14        100
15
16Dependencies
17
18        None
19
20Overview
21
22       This extension provides a mechanism for applications to retrieve a
23       tessellation of a GLU NURBS curve or surface.  The tessellation consists of
24       OpenGL Begin,End,Color,Normal,Texture, and Vertex data.
25
26       This feature is useful for those applications which need to cache
27       the primitives to use their own advanced shading model, or to
28       accelerate frame rate or to perform other computations on the surface or
29       curve data.
30
31Issues
32
33   * Is it a good idea to transform all the homogeneous coordinates into
34     affine ones? Are there any circumstances where the user prefers
35     to have the homogeneous coordinates?
36
37New Procedures and Functions
38
39     gluNurbsCallbackDataEXT(GLUnurbsObj* theNurb,
40                     void* userData);
41
42New Tokens
43
44      Accepted by the <property> parameter of NurbsProperty:
45
46        GLU_NURBS_MODE_EXT             100160
47
48      Accepted by the <value> parameter of NurbsProperty:
49
50        GLU_NURBS_TESSELLATOR_EXT      100161
51        GLU_NURBS_RENDERER_EXT         100162
52
53
54      Accepted by the <which> parameter of NurbsCallback:
55
56        GLU_NURBS_BEGIN_EXT                    100164
57        GLU_NURBS_VERTEX_EXT                   100165
58        GLU_NURBS_NORMAL_EXT                   100166
59        GLU_NURBS_COLOR_EXT                    100167
60        GLU_NURBS_TEXTURE_COORD_EXT            100168
61        GLU_NURBS_END_EXT                      100169
62
63        GLU_NURBS_BEGIN_DATA_EXT               100170
64        GLU_NURBS_VERTEX_DATA_EXT              100171
65        GLU_NURBS_NORMAL_DATA_EXT              100172
66        GLU_NURBS_COLOR_DATA_EXT               100173
67        GLU_NURBS_TEXTURE_COORD_DATA_EXT       100174
68        GLU_NURBS_END_DATA_EXT                 100175
69
70
71Additions to the GLU Specification version 1.2, section 7.1
72
73    NURBS curves and surfaces are converted to OpenGL primitives
74    by the function described in this section.  The interface employs
75    a NURBS object to describe the curves and surfaces and to specify how
76    they should be rendered. Basic trimming support is included to allow
77    more flexible definition of surfaces.
78
79    There are two ways to handle a NURBS object (curve or surface), to render or to tessellate.
80    In rendering mode, the objects are converted or
81    tessellated to a sequence of OpenGL primitives such as evaluators and
82    triangles and sent to the OpenGL pipeline for rendering.  In tessellation
83    mode, objects are converted to a sequence of triangles and triangle
84    strips and returned back to the application through a callback
85    interface for further processing.  The decomposition algorithm used for
86    rendering and for returning tessellations are not guaranteed to produce
87    identical results.
88
89
90Additions to the GLU Specification version 1.2, section 7.2
91
92    7.2 Callbacks
93
94    To define a callback for a NURBS object use:
95    void gluNurbsCallback(GLUnurbsObj *nurbsObj, GLenum which, void (*fn)());
96
97    The parameter <which> can be one of the following:
98    GLU_NURBS_BEGIN_EXT, GLU_NURBS_VERTEX_EXT, GLU_NORMAL_EXT,
99    GLU_NURBS_COLOR_EXT, GLU_NURBS_TEXTURE_COORD_EXT, GLU_END_EXT,
100    GLU_NURBS_BEGIN_DATA_EXT, GLU_NURBS_VERTEX_DATA_EXT, GLU_NORMAL_DATA_EXT,
101    GLU_NURBS_COLOR_DATA_EXT, GLU_NURBS_TEXTURE_COORD_DATA_EXT, GLU_END_DATA_EXT,
102    and GLU_ERROR,
103
104    These callbacks have the following prototypes:
105
106    void begin(GLenum type);
107    void vertex(GLfloat *vertex);
108    void normal(GLfloat *normal);
109    void color(GLfloat *color);
110    void texCoord(GLfloat *tex_coord);
111    void end(void);
112
113    void beginData(GLenum type, void* userData);
114    void vertexData(GLfloat *vertex, void* userData);
115    void normalData(GLfloat *normal, void* userData);
116    void colorData(GLfloat *color, void* userData);
117    void texCoordData(GLfloat *tex_coord, void* userData);
118    void endData(void* userData);
119
120    void error(GLenum errno);
121
122    The first 12 callbacks are for the user to get the primitives back from the
123    NURBS  tessellator when the GLU_NURBS_MODE_EXT is set to GLU_NURBS_TESSELLATOR_EXT.
124    These callbacks have no effects when the GLU_NURBS_MODE_EXT is set to GLU_NURBS_RENDERER_EXT.
125
126    There are two forms of each callback: one with a pointer to application
127    supplied data and one without. If both versions of a particular callback
128    are specified then the callback with <userData> will be used. <userData>
129    is a copy of the pointer that was specified at the last call to
130    gluNurbsCallbackDataEXT.
131
132    All callback functions can be set to NULL even when GLU_NURBS_MODE_EXT is set to
133    GLU_NURBS_TESSELLATOR_EXT.  When a callback function is set to NULL,
134    this callback function will not get invoked and the related data, if any, will be lost.
135
136    The <begin> callback indicates the start of a primitive. <type> is
137    one of GL_LINES, GL_LINE_STRIPS, GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, GL_TRIANGLES,
138    or GL_QUAD_STRIP.
139    The default begin callback function is NULL.
140
141    The <vertex> callback  indicates a vertex of the primitive.
142    The coordinates of the vertex are stored in the parameter <vertex>
143    All the generated vertices have dimension 3, that is, homogeneous
144    coordinates have been transformed into affine coordinates.
145    The default vertex callback function is NULL.
146
147    The <normal> callback is invoked as the vertex normal is generated.
148    The components of the normal are stored in the parameter <normal>.
149    In the case of a NURBS curve, the callback function is effective only when
150    the user provides a normal map (GLU_MAP1_NORMAL).
151    In the case of a NURBS surface, if a normal map (GLU_MAP2_NORMAL) is provided,
152    then the generated normal is computed from the normal map.
153    If a normal map is not provided then a surface normal is computed in
154    a manner similar to that described for evaluators when AUTO_NORMAL
155    is enabled. The  default normal callback function is NULL.
156
157    The <color> callback is invoked as the color of a vertex is generated.
158    The components of the color are stored in the parameter <color>.
159    This callback is effective only when the user provides a color map
160    (GL_MAP1_COLOR_4 or GL_MAP2_COLOR_4). <color> contains four components: R,G,B,A.
161    The default color callback function is NULL.
162
163    The <texCoord> callback is invoked as the texture coordinates
164    of a vertex are generated. These coordinates are stored in the parameter
165    <tex_coord>. The number of texture coordinates can be 1,2,3,or 4 depending
166    on which type of texture map is specified (GL_MAP*_TEXTURE_COORD_1,
167    GL_MAP*_TEXTURE_COORD_2, GL_MAP*_TEXTURE_COORD_3, GL_MAP*_TEXTURE_COORD_4 where
168    * can be either 1 or 2).
169    If no texture map is specified, this callback function will not be called.
170    The default texCoord callback function is NULL.
171
172    The <end> callback is invoked at the end of a primitive.
173    The default end callback function is NULL.
174
175    The <error> callback is invoked when a NURBS function detects an error
176    condition. There are 37 errors specific to NURBS functions, and they are
177    named GLU_NURBS_ERROR1 through GLU_NURBS_ERROR37. Strings describing
178    the meaning of these error codes can be retrieved with gluErrorString.
179
180Additions to the GLU Specification version 1.2, section 7.6
181
182     NURBS Property
183     --------------
184
185     A set of properties associated with a NURBS object affects
186     the way that NURBS are rendered or tessellated. These properties can be
187     adjusted by the user.
188
189     void gluNurbsProperty(GLnurbsObj *nurbsObj, GLenum property,
190                           GLfloat value);
191
192    allows the user to set one of the following properties: GLU_CULLING,
193    GLU_SAMPLING_TOLERANCE, GLU_SAMPLING_METHOD, GLU_PARAMETRIC_TOLERANCE,
194    GLU_DISPLAY_MODE, GLU_AUTO_LOAD_MATRIX, GLU_U_STEP,  GLU_V_STEP, and
195    GLU_NURBS_MODE_EXT. property indicates the property to be
196    modified, and value specifies the new value.
197
198    GLU_NURBS_MODE_EXT property should be set to be either GLU_NURBS_RENDERER_EXT
199    or GLU_NURBS_TESSELLATOR_EXT. When set to GLU_NURBS_RENDERER_EXT, NURBS
200    objects are tessellated into openGL primitives and sent to the pipeline for
201    rendering. When set to GLU_NURBS_TESSELLATOR_EXT, NURBS objects are
202    tessellated into a sequence of primitives such as lines, triangles and triangle strips,
203    but the vertices,
204    normals, colors, and/or textures are retrieved back through a callback interface
205    as specified in Section 7.2. This allows the user to cache the tessellated results
206    for further processing.
207
208    When GLU_NURBS_MODE_EXT is set to be GLU_NURBS_RENDERER_EXT,
209    GLU_DISPLAY_MODE specifies how a NURBS surface should be rendered. value
210    may be set to one of GLU_FILL, GLU_OUTLINE_POLY, or GLU_OUTLINE_PATCH. When set to GLU_FILL,
211    the surface is rendered as a set of polygons. GLU_OUTLINE_POLY instructs the NURBS library to
212    draw only the outlines of the polygons created by tessellation. GLU_OUTLINE_PATCH will cause
213    just the outlines of patches and trim curves defined by the user to be drawn.
214    The default is GLU_FILL.
215    When GLU_NURBS_MODE_EXT is set to be GLU_NURBS_TESSELLATOR_EXT,
216    if GLU_DISPLAY_MODE is set to GLU_FILL or GLU_OUTLINE_POLY, the NURBS surface is tessellated
217    into triangles and triangle strips and these polygon primitives are retrieved back
218    through callback functions. If GLU_DISPLAY_MODE is set to GLU_OUTLINE_PATCH, only the outlines
219    of the patches and trim curves are generated as a sequence of line strips and can be
220    retrieved back through callback functions.
221
222
223