📄 map2.html
字号:
<HTML>
<BODY>
<PRE>
<STRONG>NAME</STRONG>
<STRONG>glMap2d,</STRONG> <STRONG>glMap2f</STRONG> - define a two-dimensional evaluator
<STRONG>C</STRONG> <STRONG>SPECIFICATION</STRONG>
void <STRONG>glMap2d</STRONG>( GLenum <EM>target</EM>,
GLdouble <EM>u1</EM>,
GLdouble <EM>u2</EM>,
GLint <EM>ustride</EM>,
GLint <EM>uorder</EM>,
GLdouble <EM>v1</EM>,
GLdouble <EM>v2</EM>,
GLint <EM>vstride</EM>,
GLint <EM>vorder</EM>,
const GLdouble *<EM>points</EM> )
void <STRONG>glMap2f</STRONG>( GLenum <EM>target</EM>,
GLfloat <EM>u1</EM>,
GLfloat <EM>u2</EM>,
GLint <EM>ustride</EM>,
GLint <EM>uorder</EM>,
GLfloat <EM>v1</EM>,
GLfloat <EM>v2</EM>,
GLint <EM>vstride</EM>,
GLint <EM>vorder</EM>,
const GLfloat *<EM>points</EM> )
<STRONG>PARAMETERS</STRONG>
<EM>target</EM> Specifies the kind of values that are generated by
the evaluator. Symbolic constants
<STRONG>GL_MAP2_VERTEX_3</STRONG>, <STRONG>GL_MAP2_VERTEX_4</STRONG>, <STRONG>GL_MAP2_INDEX</STRONG>,
<STRONG>GL_MAP2_COLOR_4</STRONG>, <STRONG>GL_MAP2_NORMAL</STRONG>,
<STRONG>GL_MAP2_TEXTURE_COORD_1</STRONG>, <STRONG>GL_MAP2_TEXTURE_COORD_2</STRONG>,
<STRONG>GL_MAP2_TEXTURE_COORD_3</STRONG>, and
<STRONG>GL_MAP2_TEXTURE_COORD_4</STRONG> are accepted.
<EM>u1</EM>, <EM>u2</EM> Specify a linear mapping of u, as presented to
<STRONG>glEvalCoord2</STRONG>, to <STRONG>^</STRONG>, one of the two variables that
are evaluated by the equations specified by this
command. Initially, <EM>u1</EM> is 0 and <EM>u2</EM> is 1.
<EM>ustride</EM> Specifies the number of floats or doubles between
the beginning of control point R and the
beginning of control point R ij, where i and j
are the u and v control poin<STRONG>t</STRONG>i<STRONG>indi</STRONG>ces,
respectively. This allows control points to be
embedded in arbitrary data structures. The only
constraint is that the values for a particular
control point must occupy contiguous memory
locations. The initial value of <EM>ustride</EM> is 0.
<EM>uorder</EM> Specifies the dimension of the control point array
in the u axis. Must be positive. The initial value
is 1.
<EM>v1</EM>, <EM>v2</EM> Specify a linear mapping of v, as presented to
<STRONG>glEvalCoord2</STRONG>, to <STRONG>^</STRONG>, one of the two variables that
are evaluated by the equations specified by this
command. Initially, <EM>v1</EM> is 0 and <EM>v2</EM> is 1.
<EM>vstride</EM> Specifies the number of floats or doubles between
the beginning of control point R and the
beginning of control point R ij, where i and j
are the u and v control poin<STRONG>t</STRONG>(<STRONG>indi</STRONG>ces,
respectively. This allows control points to be
embedded in arbitrary data structures. The only
constraint is that the values for a particular
control point must occupy contiguous memory
locations. The initial value of <EM>vstride</EM> is 0.
<EM>vorder</EM> Specifies the dimension of the control point array
in the v axis. Must be positive. The initial value
is 1.
<EM>points</EM> Specifies a pointer to the array of control points.
<STRONG>DESCRIPTION</STRONG>
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 on to further stages of GL processing
just as if they had been presented using <STRONG>glVertex</STRONG>, <STRONG>glNormal</STRONG>,
<STRONG>glTexCoord</STRONG>, and <STRONG>glColor</STRONG> 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 surfaces used in computer graphics,
including B-spline surfaces, NURBS surfaces, Bezier
surfaces, and so on.
Evaluators define surfaces based on bivariate Bernstein
polynomials. Define p(<STRONG>^</STRONG>,<STRONG>^</STRONG>) as
n m
R R n m
p(<STRONG>^</STRONG>,<STRONG>^</STRONG>) = i=0j=0Bi(<STRONG>^</STRONG>)Bj(<STRONG>^</STRONG>)Rij
where R is a control point, Bn(<STRONG>^</STRONG>) is the ith Bernstein
polynom<STRONG>ia</STRONG>l of degree i
n (<EM>uorder</EM> = n+1)
n (n ) i n-i
Bi(<STRONG>^</STRONG>) = | |<STRONG>^</STRONG> (1-<STRONG>^</STRONG>)
(i )
and Bm(<STRONG>^</STRONG>) is the jth Bernstein polynomial of degree m
(<EM>vord</EM><STRONG><</STRONG>EM>er</EM> = m+1)
m (m ) j m-j
Bj(<STRONG>^</STRONG>) = | |<STRONG>^</STRONG> (1-<STRONG>^</STRONG>)
(j )
Recall that
0 (n )
0 <EM>=</EM> 1 and | | <EM>=</EM> 1
( 0 )
<STRONG>glMap2</STRONG> 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 <STRONG>glEnable</STRONG> and <STRONG>glDisable</STRONG> with the map
name, one of the nine predefined values for <EM>target</EM>,
described below. When <STRONG>glEvalCoord2</STRONG> presents values u and v,
the bivariate Bernstein polynomials are evaluated using <STRONG>^</STRONG>
and <STRONG>^</STRONG>, where
<STRONG>^</STRONG> = _<STRONG>_</STRONG>_<STRONG>_</STRONG>_<STRONG>__</STRONG>
u2 - u1
<STRONG>^</STRONG> = _<STRONG>_</STRONG>_<STRONG>_</STRONG>_<STRONG>__</STRONG>
v2 - v1
<EM>target</EM> is a symbolic constant that indicates what kind of
control points are provided in <EM>points</EM>, and what output is
generated when the map is evaluated. It can assume one of
nine predefined values:
<STRONG>GL_MAP2_VERTEX_3</STRONG> Each control point is three
floating-point values representing
x, y, and z. Internal <STRONG>glVertex3</STRONG>
commands are generated when the map
is evaluated.
<STRONG>GL_MAP2_VERTEX_4</STRONG> Each control point is four
floating-point values representing
x, y, z, and w. Internal <STRONG>glVertex4</STRONG>
commands are generated when the map
is evaluated.
<STRONG>GL_MAP2_INDEX</STRONG> Each control point is a single
floating-point value representing a
color index. Internal <STRONG>glIndex</STRONG>
commands are generated when the map
is evaluated but the current index
is not updated with the value of
these <STRONG>glIndex</STRONG> commands.
<STRONG>GL_MAP2_COLOR_4</STRONG> Each control point is four
floating-point values representing
red, green, blue, and alpha.
Internal <STRONG>glColor4</STRONG> commands are
generated when the map is evaluated
but the current color is not
updated with the value of these
<STRONG>glColor4</STRONG> commands.
<STRONG>GL_MAP2_NORMAL</STRONG> Each control point is three
floating-point values representing
the x, y, and z components of a
normal vector. Internal <STRONG>glNormal</STRONG>
commands are generated when the map
is evaluated but the current normal
is not updated with the value of
these <STRONG>glNormal</STRONG> commands.
<STRONG>GL_MAP2_TEXTURE_COORD_1</STRONG> Each control point is a single
floating-point value representing
the s texture coordinate. Internal
<STRONG>glTexCoord1</STRONG> commands are generated
when the map is evaluated but the
current texture coordinates are not
updated with the value of these
<STRONG>glTexCoord</STRONG> commands.
<STRONG>GL_MAP2_TEXTURE_COORD_2</STRONG> Each control point is two
floating-point values representing
the s and t texture coordinates.
Internal
<STRONG>glTexCoord2</STRONG> commands are generated
when the map is evaluated but the
current texture coordinates are not
updated with the value of these
<STRONG>glTexCoord</STRONG> commands.
<STRONG>GL_MAP2_TEXTURE_COORD_3</STRONG> Each control point is three
floating-point values representing
the s, t, and r texture
coordinates. Internal <STRONG>glTexCoord3</STRONG>
commands are generated when the map
is evaluated but the current
texture coordinates are not updated
with the value of these <STRONG>glTexCoord</STRONG>
commands.
<STRONG>GL_MAP2_TEXTURE_COORD_4</STRONG> Each control point is four
floating-point values representing
the s, t, r, and q texture
coordinates. Internal
<STRONG>glTexCoord4</STRONG> commands are generated
when the map is evaluated but the
current texture coordinates are not
updated with the value of these
<STRONG>glTexCoord</STRONG> commands.
<EM>ustride</EM>, <EM>uorder</EM>, <EM>vstride</EM>, <EM>vorder</EM>, and <EM>points</EM> define the
array addressing for accessing the control points. <EM>points</EM>
is the location of the first control point, which occupies
one, two, three, or four contiguous memory locations,
depending on which map is being defined. There are
uorderxvorder control points in the array. <EM>ustride</EM>
specifies how many float or double locations are skipped to
advance the internal memory pointer from control point R
to control point R . <EM>vstride</EM> specifies how many fl<STRONG>oa</STRONG>t
or double location<STRONG>s</STRONG>i<STRONG>are</STRONG>jskipped to advance the internal
memory pointer from control point R to control point
R . ij
i(j+1)
<STRONG>NOTES</STRONG>
As is the case with all GL commands that accept pointers to
data, it is as if the contents of <EM>points</EM> were copied by
<STRONG>glMap2</STRONG> before <STRONG>glMap2</STRONG> returns. Changes to the contents of
<EM>points</EM> have no effect after <STRONG>glMap2</STRONG> is called.
Initially, <STRONG>GL_AUTO_NORMAL</STRONG> is enabled. If <STRONG>GL_AUTO_NORMAL</STRONG> is
enabled, normal vectors are generated when either
<STRONG>GL_MAP2_VERTEX_3</STRONG> or <STRONG>GL_MAP2_VERTEX_4</STRONG> is used to generate
vertices.
<STRONG>ERRORS</STRONG>
<STRONG>GL_INVALID_ENUM</STRONG> is generated if <EM>target</EM> is not an accepted
value.
<STRONG>GL_INVALID_VALUE</STRONG> is generated if <EM>u1</EM> is equal to <EM>u2</EM>, or if <EM>v1</EM>
is equal to <EM>v2</EM>.
<STRONG>GL_INVALID_VALUE</STRONG> is generated if either <EM>ustride</EM> or <EM>vstride</EM>
is less than the number of values in a control point.
<STRONG>GL_INVALID_VALUE</STRONG> is generated if either <EM>uorder</EM> or <EM>vorder</EM> is
less than 1 or greater than the return value of
<STRONG>GL_MAX_EVAL_ORDER</STRONG>.
<STRONG>GL_INVALID_OPERATION</STRONG> is generated if <STRONG>glMap2</STRONG> is executed
between the execution of <STRONG>glBegin</STRONG> and the corresponding
execution of <STRONG>glEnd</STRONG>.
<STRONG>ASSOCIATED</STRONG> <STRONG>GETS</STRONG>
<STRONG>glGetMap</STRONG>
<STRONG>glGet</STRONG> with argument <STRONG>GL_MAX_EVAL_ORDER</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_VERTEX_3</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_VERTEX_4</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_INDEX</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_COLOR_4</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_NORMAL</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_TEXTURE_COORD_1</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_TEXTURE_COORD_2</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_TEXTURE_COORD_3</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_MAP2_TEXTURE_COORD_4</STRONG>
<STRONG>SEE</STRONG> <STRONG>ALSO</STRONG>
<STRONG>glBegin</STRONG>, <STRONG>glColor</STRONG>, <STRONG>glEnable</STRONG>, <STRONG>glEvalCoord</STRONG>, <STRONG>glEvalMesh</STRONG>,
<STRONG>glEvalPoint</STRONG>, <STRONG>glMap1</STRONG>, <STRONG>glMapGrid</STRONG>, <STRONG>glNormal</STRONG>, <STRONG>glTexCoord</STRONG>,
<STRONG>glVertex</STRONG>
</PRE>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -