The command glMap1() defines a one-dimensional Bezier evaluator that
uses the Bernstein Polynomial equations:
void glMap1{fd}(GLenum target, TYPEu1, TYPEu2, GLint stride, GLint order, const TYPE*points);
The target parameter specifies
what the control points represent (see Table),
and therefore
how many values need to be supplied in points.
The second two parameters, u1 and u2,
indicate the range for the variable u.
The variable stride
is the number of single- or double-precision values (as appropriate) in
each block of storage. Thus, it's an offset value between the beginning
of one control point and the beginning of the next.
The order is the degree plus one, and it should agree with the
number of control points.
The points parameter points to the first
coordinate of the first control point. Using the example data structure
for glMap1*(), use the following types for points:
GLfloat ctlpoints[dimPoints][nbPoints] in C
float ctlpoints[ nbPoints * dimPoint] in Java
The problem is that Java does not handle multidimensional arrays like C, where a multidimensional array, it is stored in memory as if it were 1D. Whereas to keep the control points in one memory block in Java they must be declared in a 1D array.
public void glMap1f(int target,
float u1,
float u2,
int stride,
int order,
float[] points,
int points_offset)
OR:
public void glMap1f(int target,
float u1,
float u2,
int stride,
int order,
FloatBuffer points)
The points can represent vertices, RGBA color data, normal vectors, or texture coordinates. Forexample, with GL_MAP1_COLOR_4, the evaluator generates color data along a curve in four-dimensional (RGBA) color space.
| Parameter | Meaning |
|---|---|
| GL_MAP1_VERTEX_3 | x, y, z vertex coordinates |
| GL_MAP1_VERTEX_4 | x, y, z, w vertex coordinates |
| GL_MAP1_INDEX | color index |
| GL_MAP1_COLOR_4 | R, G, B, A |
| GL_MAP1_NORMAL | normal coordinates |
| GL_MAP1_TEXTURE_COORD_1 | s texture coordinates |
| GL_MAP1_TEXTURE_COORD_2 | s, t texture coordinates |
| GL_MAP1_TEXTURE_COORD_3 | s, t, r texture coordinates |
| GL_MAP1_TEXTURE_COORD_4 | s, t, r, q texture coordinates |
Also use the parameter values
listed in the Table to enable each defined evaluator before you invoke
it.
Pass the appropriate value to glEnable() or glDisable()
to enable or disable the evaluator.
More than one evaluator can be evaluated at a time. If you have both a GL_MAP1_VERTEX_3 and a GL_MAP1_COLOR_4 evaluator defined and enabled, for example, then calls to glEvalCoord1() generate both a position and a color. Evaluators can be used to generate any combination of vertex, normal, color, and texture-coordinate data.
void glEvalCoord1{fd}{v}(TYPE u);
u is the value (or a pointer to the value, in the vector version of the command) that is the domain coordinate.