3
The basic idea is following. Using 'glMap*' functions a Bezier curves, NURBS,
4
and etc. are defined. Then, if it is neccessary to draw this curve, glEvalCord*
5
functions should be called to produced desired number of vertices on this
6
curve. As much vertices are generated beter the curve is displayed.
8
(desired number of times)
10
This defines evaluator functions
12
glMap1{fd}(target, u1, u2, stride, order, ctrlpoints)
14
GL_MAP1_VERTEX3 x,y,z vertices
15
GL_MAP1_VERTEX4 x,y,z,w vertices
16
GL_MAP1_COLOR4 r,g,b,a colors
17
GL_MAP1_NORMAL normal coordinates
18
GL_MAP1_TEXTURE_COORD_1 s - texture coordinate
19
GL_MAP1_TEXTURE_COORD_2 s,t - texture coords.
20
GL_MAP1_TEXTURE_COORD_3 s,t,r - texture coords.
21
GL_MAP1_TEXTURE_COORD_4 s,t,r,q - texture coords.
22
- It is possible to sequentialy define several targets, so when
23
the glEvalCoords are called, both coords. and color (for example)
25
- Coresponding targets should be enabled using glEnable call
27
u1,u2 - Is lowest and highest values which would be passed to the
28
glEvalCord function. The lowest value is coresponding to a
29
start point of spline and the highest to the end point.
30
stride - The number of floating-point values to advance in the data
31
between one control point and the next
32
order - order of spline (degree + 1, normally equal to number of
34
ctrlpoints - coordinates of control points
36
glEnable(<target>); - enabling target
38
glEvalCoord1{fd}{v}(value);
39
Generates vertex on the spline created with 'glMap1f' functio.
40
value - addresses poisition in the spline (should be between "from" and
41
"to" values defined in the g1Map1f call)
43
glMapGrid1(n, from, to)
44
Used to define a grid of 'n' uniformly distributed between 'from' and 'to'
46
glEvalMesh1(<mode>, p1, p2)
47
Applies part of currently defined GRID to all enabled evaluators
48
p1, p2: number of points defining part of grids 0 <= p1 < p2 <= n
49
mode: defines type of primitives to be drawn
51
GL_LINE conect lines along the curve
54
Defining 2D Evaluators
55
----------------------
56
targets: GL_MAP2_VERTEX_3, GL_MAP2_VERTEX_4, ...
59
u1, u2, ustride, uorder,
60
v1, v2, vstride, vorder,
63
glEvalCoord2{fd}{v}(u,v)
65
glEnable(GL_AUTO_NORMAL) - enables auto-generation of normals
67
glMapGrid2{fd}(nu, u1, u2, nv, v1, v2)
68
glEvalMesh2(mode, p1, p2, q2, q2);
69
modes: GL_FILL (quad-mesh polygons), GL_POINT, GL_LINE
71
NURBS (Non-Uniform Rational B-Spline)
72
=====================================
73
Implemented by OpenGL utility library on top of the evaluators
76
GLUnurbsObj gluNewNurbsRenderer() - creating NURBS object
77
gluNurbsProperty(GLUnurbsObj, prop, value) - setting property
78
GLU_SAMPLING_TOLERANCE = limit - limits maximal polygon size
79
NURBS are rendered as primitives using some Grid. This property
80
defines maximal size of grid's cell.
81
GLU_DISPLAY_MODE = <mode>
82
GLU_FILL - renders as polygons
83
GLU_OUTLINE_POLYGON - renders as outlines of polygons
84
GLU_OUTLINE_PATCH - enders the outlines of patches and
86
GLU_CULLING = <enabled> - speed up performance by not performing
87
tessellation if the NURBS object falls
88
completely outside the viewing volume
89
GLU_AUTO_LOAD_MATRIX - determines whether transformation matrices
90
are downloaded from the OpenGL server (GL_TRUE)
91
or whether the application must supply these
92
matrices with gluLoadSamplingMatrices()
96
gluBeginSurface(GLUnurbsObj);
97
void gluNurbsSurface (GLUnurbsObj, - Configuring NURBS
98
GLint uknot_count, GLfloat *uknot, - KNOT Vector
99
GLint vknot_count, GLfloat *vknot, - KNOT Vector
100
GLint u_stride, GLint v_stride, - number of floating-point values
101
between control points in each
103
GLfloat *ctlarray, - control points, the number of control
104
points along each parameter as the
105
number of knots minus the order
106
GLint uorder, GLint vorder, - order of NURBS
107
GLenum type); - ne of the two-dimensional evaluator
108
types: GL_MAP2_VERTEX_3, ...
109
gluEndSurface(GLUnurbsObj);
112
gluBeginCurve(GLUnurbsObj)
113
gluNurbsCurve (GLUnurbsObj, uknot_count, uknot, u_stride, ctlarray, uorder, type);
114
gluEndCurve(GLUnurbsObj)
117
- You need to consider the orientation of trimming curves - that is,
118
whether they're counterclockwise or clockwise - to make sure you include
119
the desired part of the surface. If you imagine walking along a curve,
120
everything to the left is included and everything to the right is trimmed
123
gluBegin(Curve|Surface)
124
gluNurbs(Curve|Surface)
125
.......................
128
gluPwlCurve(GLUnurbsObj, GLint count, GFloat *array, GLint stride, GLEnum type )
129
- piecewise linear trimming curve: There are 'count' points on the
130
curve, and they're given by 'array'.
131
stride: number of floating-point values to the next vertex
132
type: GLU_MAP1_TRIM_2 or GLU_MAP1_TRIM_3
134
gluNurbsCurve(GLUnurbsObj, uknot_count, uknot, u_stride, ctlarray, uorder, type)
135
- NURBS trimming curve
138
gluEnd(Curve|Surface)