Name
gl.Map -- define a one- or two-dimensional evaluator
Synopsis
gl.Map(target, u1, u2, pointsArray)
gl.Map(target, u1, u2, v1, v2, pointsArray)
Function
Evaluators provide a way to use polynomial or rational polynomial mapping to produce vertices, normals, texture coordinates, and colors. The values produced by an evaluator are sent to further stages of GL processing just as if they had been presented using gl.Vertex(), gl.Normal(), gl.TexCoord(), and gl.Color() commands, except that the generated values do not update the current normal, texture coordinates, or color.

All polynomial or rational polynomial splines of any degree (up to the maximum degree supported by the GL implementation) can be described using evaluators. These include almost all splines used in computer graphics: B-splines, Bezier curves, Hermite splines, and so on.

gl.Map() is used to define the basis and to specify what kind of values are produced. Once defined, a map can be enabled and disabled by calling gl.Enable() and gl.Disable() with the map name, one of the nine predefined values for target described below. gl.EvalCoord() evaluates the one-dimensional maps that are enabled. When gl.EvalCoord() presents a value u or values u and v, the Bernstein functions are evaluated using u^ and v^ , where

 
u^ = (u - u1) / (u2 - u1)
v^ = (v - v1) / (v2 - v1)

target is a symbolic constant that indicates what kind of control points are provided in pointsArray, and what output is generated when the map is evaluated. In one-dimensional mode it can assume one of the following nine predefined values:

#GL_MAP1_VERTEX_3
Each control point is three floating-point values representing x, y, and z. Internal gl.Vertex() commands are generated when the map is evaluated.

#GL_MAP1_VERTEX_4
Each control point is four floating-point values representing x, y, z, and w. Internal gl.Vertex() commands are generated when the map is evaluated.

#GL_MAP1_INDEX
Each control point is a single floating-point value representing a color index. Internal gl.Index() commands are generated when the map is evaluated but the current index is not updated with the value of these gl.Index() commands.

#GL_MAP1_COLOR_4
Each control point is four floating-point values representing red, green, blue, and alpha. Internal gl.Color() commands are generated when the map is evaluated but the current color is not updated with the value of these gl.Color() commands.

#GL_MAP1_NORMAL
Each control point is three floating-point values representing the x, y, and z components of a normal vector. Internal gl.Normal() commands are generated when the map is evaluated but the current normal is not updated with the value of these gl.Normal() commands.

#GL_MAP1_TEXTURE_COORD_1
Each control point is a single floating-point value representing the s texture coordinate. Internal gl.TexCoord() commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these gl.TexCoord() commands.

#GL_MAP1_TEXTURE_COORD_2
Each control point is two floating-point values representing the s and t texture coordinates. Internal gl.TexCoord() commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these gl.TexCoord() commands.

#GL_MAP1_TEXTURE_COORD_3
Each control point is three floating-point values representing the s, t, and r texture coordinates. Internal gl.TexCoord() commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these gl.TexCoord() commands.

#GL_MAP1_TEXTURE_COORD_4
Each control point is four floating-point values representing the s, t, r, and q texture coordinates. Internal gl.TexCoord() commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these gl.TexCoord() commands.

In two-dimensional mode the following predefined constants are supported:

#GL_MAP2_VERTEX_3
Each control point is three floating-point values representing x, y, and z. Internal gl.Vertex() commands are generated when the map is evaluated.

#GL_MAP2_VERTEX_4
Each control point is four floating-point values representing x, y, z, and w. Internal gl.Vertex() commands are generated when the map is evaluated.

#GL_MAP2_INDEX
Each control point is a single floating-point value representing a color index. Internal gl.Index() commands are generated when the map is evaluated but the current index is not updated with the value of these gl.Index() commands.

#GL_MAP2_COLOR_4
Each control point is four floating-point values representing red, green, blue, and alpha. Internal gl.Color() commands are generated when the map is evaluated but the current color is not updated with the value of these gl.Color() commands.

#GL_MAP2_NORMAL
Each control point is three floating-point values representing the x, y, and z components of a normal vector. Internal gl.Normal() commands are generated when the map is evaluated but the current normal is not updated with the value of these gl.Normal() commands.

#GL_MAP2_TEXTURE_COORD_1
Each control point is a single floating-point value representing the s texture coordinate. Internal gl.TexCoord() commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these gl.TexCoord() commands.

#GL_MAP2_TEXTURE_COORD_2
Each control point is two floating-point values representing the s and t texture coordinates. Internal gl.TexCoord() commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these gl.TexCoord() commands.

#GL_MAP2_TEXTURE_COORD_3
Each control point is three floating-point values representing the s, t, and r texture coordinates. Internal gl.TexCoord() commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these gl.TexCoord() commands.

#GL_MAP2_TEXTURE_COORD_4
Each control point is four floating-point values representing the s, t, r, and q texture coordinates. Internal gl.TexCoord() commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these gl.TexCoord() commands.

Initially, #GL_AUTO_NORMAL is enabled. If #GL_AUTO_NORMAL is enabled, normal vectors are generated when either #GL_MAP2_VERTEX_3 or #GL_MAP2_VERTEX_4 is used to generate vertices.

Please consult an OpenGL reference manual for more information.

Inputs
target
specifies the kind of values that are generated by the evaluator (see above)
u1
specify a linear mapping of u, as presented to gl.EvalCoord(), to u^ , the variable that is evaluated by the equations specified by this command
u2
specify a linear mapping of u, as presented to gl.EvalCoord(), to u^ , the variable that is evaluated by the equations specified by this command
v1
specify a linear mapping of v, as presented to gl.EvalCoord(), to v^ , one of the two variables that are evaluated by the equations specified by this command
v2
specify a linear mapping of v, as presented to gl.EvalCoord(), to v^ , one of the two variables that are evaluated by the equations specified by this command
pointsArray
specifies a table containing a number of control points (see above)
Errors
#GL_INVALID_ENUM is generated if target is not an accepted value.

#GL_INVALID_VALUE is generated if u1 is equal to u2, or if v1 is equal to v2.

#GL_INVALID_OPERATION is generated if gl.Map() is executed between the execution of gl.Begin() and the corresponding execution of gl.End().

Associated gets
gl.GetMap()

gl.Get() with argument #GL_MAX_EVAL_ORDER

gl.IsEnabled() with argument #GL_MAP1_VERTEX_3

gl.IsEnabled() with argument #GL_MAP1_VERTEX_4

gl.IsEnabled() with argument #GL_MAP1_INDEX

gl.IsEnabled() with argument #GL_MAP1_COLOR_4

gl.IsEnabled() with argument #GL_MAP1_NORMAL

gl.IsEnabled() with argument #GL_MAP1_TEXTURE_COORD_1

gl.IsEnabled() with argument #GL_MAP1_TEXTURE_COORD_2

gl.IsEnabled() with argument #GL_MAP1_TEXTURE_COORD_3

gl.IsEnabled() with argument #GL_MAP1_TEXTURE_COORD_4

gl.IsEnabled() with argument #GL_MAP2_VERTEX_3

gl.IsEnabled() with argument #GL_MAP2_VERTEX_4

gl.IsEnabled() with argument #GL_MAP2_INDEX

gl.IsEnabled() with argument #GL_MAP2_COLOR_4

gl.IsEnabled() with argument #GL_MAP2_NORMAL

gl.IsEnabled() with argument #GL_MAP2_TEXTURE_COORD_1

gl.IsEnabled() with argument #GL_MAP2_TEXTURE_COORD_2

gl.IsEnabled() with argument #GL_MAP2_TEXTURE_COORD_3

gl.IsEnabled() with argument #GL_MAP2_TEXTURE_COORD_4


Show TOC