1GLMAP2(3G) GLMAP2(3G)
2
3
4
6 glMap2d, glMap2f - define a two-dimensional evaluator
7
8
10 void glMap2d( GLenum target,
11 GLdouble u1,
12 GLdouble u2,
13 GLint ustride,
14 GLint uorder,
15 GLdouble v1,
16 GLdouble v2,
17 GLint vstride,
18 GLint vorder,
19 const GLdouble *points )
20 void glMap2f( GLenum target,
21 GLfloat u1,
22 GLfloat u2,
23 GLint ustride,
24 GLint uorder,
25 GLfloat v1,
26 GLfloat v2,
27 GLint vstride,
28 GLint vorder,
29 const GLfloat *points )
30
31
33 target Specifies the kind of values that are generated by the evalua‐
34 tor. Symbolic constants GL_MAP2_VERTEX_3, GL_MAP2_VERTEX_4,
35 GL_MAP2_INDEX, GL_MAP2_COLOR_4, GL_MAP2_NORMAL,
36 GL_MAP2_TEXTURE_COORD_1, GL_MAP2_TEXTURE_COORD_2,
37 GL_MAP2_TEXTURE_COORD_3, and GL_MAP2_TEXTURE_COORD_4 are
38 accepted.
39
40 u1, u2 Specify a linear mapping of u, as presented to glEvalCoord2,
41 to ^u, one of the two variables that are evaluated by the equa‐
42 tions specified by this command. Initially, u1 is 0 and u2 is
43 1.
44
45 ustride Specifies the number of floats or doubles between the begin‐
46 ning of control point Rij and the beginning of control point
47 R(i+1)j, where i and j are the u and v control point indices,
48 respectively. This allows control points to be embedded in
49 arbitrary data structures. The only constraint is that the
50 values for a particular control point must occupy contiguous
51 memory locations. The initial value of ustride is 0.
52
53 uorder Specifies the dimension of the control point array in the u
54 axis. Must be positive. The initial value is 1.
55
56 v1, v2 Specify a linear mapping of v, as presented to glEvalCoord2,
57 to ^v, one of the two variables that are evaluated by the equa‐
58 tions specified by this command. Initially, v1 is 0 and v2 is
59 1.
60
61 vstride Specifies the number of floats or doubles between the begin‐
62 ning of control point Rij and the beginning of control point
63 Ri(j+1), where i and j are the u and v control point indices,
64 respectively. This allows control points to be embedded in
65 arbitrary data structures. The only constraint is that the
66 values for a particular control point must occupy contiguous
67 memory locations. The initial value of vstride is 0.
68
69 vorder Specifies the dimension of the control point array in the v
70 axis. Must be positive. The initial value is 1.
71
72 points Specifies a pointer to the array of control points.
73
75 Evaluators provide a way to use polynomial or rational polynomial map‐
76 ping to produce vertices, normals, texture coordinates, and colors.
77 The values produced by an evaluator are sent on to further stages of GL
78 processing just as if they had been presented using glVertex, glNormal,
79 glTexCoord, and glColor commands, except that the generated values do
80 not update the current normal, texture coordinates, or color.
81
82 All polynomial or rational polynomial splines of any degree (up to the
83 maximum degree supported by the GL implementation) can be described
84 using evaluators. These include almost all surfaces used in computer
85 graphics, including B-spline surfaces, NURBS surfaces, Bezier surfaces,
86 and so on.
87
88 Evaluators define surfaces based on bivariate Bernstein polynomials.
89 Define p(^u,^v) as
90
91 p(^u,^v)=in=Σ0jm=Σ0Bni(^u)Bmj(^v)Rij
92
93
94 where Rij is a control point, Bni(^u) is the ith Bernstein polynomial of
95 degree
96 n (uorder = n+1)
97
98 Bni(^u)=⎛⎝n⎞⎠^ui(1−^u)n−i
99 i
100 and Bmj(^v) is the jth Bernstein polynomial of degree m (vorder = m+1)
101
102 Bmj(^v)=⎛⎝m⎞⎠^vj(1−^v)m−j
103 j
104 Recall that
105 00≡1 and ⎛⎝n⎞⎠≡1
106 0
107 glMap2 is used to define the basis and to specify what kind of values
108 are produced. Once defined, a map can be enabled and disabled by call‐
109 ing glEnable and glDisable with the map name, one of the nine prede‐
110 fined values for target, described below. When glEvalCoord2 presents
111 values u and v, the bivariate Bernstein polynomials are evaluated using
112 ^u and ^v, where
113
114 ^u=u_u2_−−_uu_11_
115
116 ^v=v_v2_−−_vv_11_
117
118 target is a symbolic constant that indicates what kind of control
119 points are provided in points, and what output is generated when the
120 map is evaluated. It can assume one of nine predefined values:
121
122 GL_MAP2_VERTEX_3 Each control point is three floating-point
123 values representing x, y, and z. Internal
124 glVertex3 commands are generated when the map
125 is evaluated.
126
127 GL_MAP2_VERTEX_4 Each control point is four floating-point val‐
128 ues representing x, y, z, and w. Internal
129 glVertex4 commands are generated when the map
130 is evaluated.
131
132 GL_MAP2_INDEX Each control point is a single floating-point
133 value representing a color index. Internal
134 glIndex commands are generated when the map is
135 evaluated but the current index is not updated
136 with the value of these glIndex commands.
137
138 GL_MAP2_COLOR_4 Each control point is four floating-point val‐
139 ues representing red, green, blue, and alpha.
140 Internal glColor4 commands are generated when
141 the map is evaluated but the current color is
142 not updated with the value of these glColor4
143 commands.
144
145 GL_MAP2_NORMAL Each control point is three floating-point
146 values representing the x, y, and z components
147 of a normal vector. Internal glNormal com‐
148 mands are generated when the map is evaluated
149 but the current normal is not updated with the
150 value of these glNormal commands.
151
152 GL_MAP2_TEXTURE_COORD_1 Each control point is a single floating-point
153 value representing the s texture coordinate.
154 Internal
155 glTexCoord1 commands are generated when the
156 map is evaluated but the current texture coor‐
157 dinates are not updated with the value of
158 these glTexCoord commands.
159
160 GL_MAP2_TEXTURE_COORD_2 Each control point is two floating-point val‐
161 ues representing the s and t texture coordi‐
162 nates. Internal
163 glTexCoord2 commands are generated when the
164 map is evaluated but the current texture coor‐
165 dinates are not updated with the value of
166 these glTexCoord commands.
167
168 GL_MAP2_TEXTURE_COORD_3 Each control point is three floating-point
169 values representing the s, t, and r texture
170 coordinates. Internal glTexCoord3 commands
171 are generated when the map is evaluated but
172 the current texture coordinates are not
173 updated with the value of these glTexCoord
174 commands.
175
176 GL_MAP2_TEXTURE_COORD_4 Each control point is four floating-point val‐
177 ues representing the s, t, r, and q texture
178 coordinates. Internal
179 glTexCoord4 commands are generated when the
180 map is evaluated but the current texture coor‐
181 dinates are not updated with the value of
182 these glTexCoord commands.
183
184 ustride, uorder, vstride, vorder, and points define the array address‐
185 ing for accessing the control points. points is the location of the
186 first control point, which occupies one, two, three, or four contiguous
187 memory locations, depending on which map is being defined. There are
188 uorder×vorder control points in the array. ustride specifies how many
189 float or double locations are skipped to advance the internal memory
190 pointer from control point Rij to control point R(i+1)j. vstride spec‐
191 ifies how many float or double locations are skipped to advance the
192 internal memory pointer from control point Rij to control point
193 Ri(j+1).
194
196 As is the case with all GL commands that accept pointers to data, it is
197 as if the contents of points were copied by glMap2 before glMap2
198 returns. Changes to the contents of points have no effect after glMap2
199 is called.
200
201 Initially, GL_AUTO_NORMAL is enabled. If GL_AUTO_NORMAL is enabled,
202 normal vectors are generated when either GL_MAP2_VERTEX_3 or
203 GL_MAP2_VERTEX_4 is used to generate vertices.
204
206 GL_INVALID_ENUM is generated if target is not an accepted value.
207
208 GL_INVALID_VALUE is generated if u1 is equal to u2, or if v1 is equal
209 to v2.
210
211 GL_INVALID_VALUE is generated if either ustride or vstride is less than
212 the number of values in a control point.
213
214 GL_INVALID_VALUE is generated if either uorder or vorder is less than 1
215 or greater than the return value of GL_MAX_EVAL_ORDER.
216
217 GL_INVALID_OPERATION is generated if glMap2 is executed between the
218 execution of glBegin and the corresponding execution of glEnd.
219
220 When the GL_ARB_multitexture extension is supported,
221 GL_INVALID_OPERATION is generated if glMap2 is called and the value of
222 GL_ACTIVE_TEXTURE_ARB is not GL_TEXTURE0_ARB.
223
225 glGetMap
226 glGet with argument GL_MAX_EVAL_ORDER
227 glIsEnabled with argument GL_MAP2_VERTEX_3
228 glIsEnabled with argument GL_MAP2_VERTEX_4
229 glIsEnabled with argument GL_MAP2_INDEX
230 glIsEnabled with argument GL_MAP2_COLOR_4
231 glIsEnabled with argument GL_MAP2_NORMAL
232 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_1
233 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_2
234 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_3
235 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_4
236
238 glBegin(3G), glColor(3G), glEnable(3G), glEvalCoord(3G),
239 glEvalMesh(3G), glEvalPoint(3G), glMap1(3G), glMapGrid(3G),
240 glNormal(3G), glTexCoord(3G), glVertex(3G)
241
242
243
244 GLMAP2(3G)