![]() |
|Download Files|
![]() ![]() ![]() ![]() ![]() Next: 5.2 Selection Up: 5 Special Functions Previous: 5 Special Functions
5.1 EvaluatorsEvaluators provide a means to use a polynomial or rational polynomial mapping to produce vertex, normal, and texture coordinates, and colors. The values so produced are sent on to further stages of the GL as if they had been provided directly by the client. Transformations, lighting, primitive assembly, rasterization, and per-pixel operations are not affected by the use of evaluators.
Consider the
with
the ith Bernstein polynomial of degree n
(recall that
void Map1[fd] ( enum type, T
type is a symbolic constant indicating the range of the defined
polynomial.
Its possible values,
along with the evaluations that each indicates,
are given in Table 5.1.
stride is the number of single- or double-precision values (as appropriate)
in each block of storage.
The error INVALID_VALUE results if
The error INVALID_VALUE results if Map2 is analogous to Map1 , except that it describes bivariate polynomials of the form The form of the Map2 command is
void Map2[fd] ( enum target, T
target is a range type selected from the same group
as is used for Map1 , except that the string MAP1 is replaced with
MAP2.
points is a pointer to
values (either single- or double-precision floating-point, as appropriate)
past the first value pointed to by points.
The evaluation of a defined map is enabled or disabled with
Enable and Disable using the constant corresponding
to the map as described above.
The error INVALID_VALUE results if either ustride or vstride is less than k,
or if
Figure 5.1 describes map evaluation schematically; an evaluation of enabled maps is effected in one of two ways. The first way is to use
void EvalCoord[12][fd] ( T arg ) ;
EvalCoord1 causes
evaluation of the enabled 1-dimensional maps.
The argument is the value (or a pointer to the value) that is the
domain coordinate, When one of the EvalCoord commands is issued, all currently enabled maps of the indicated dimension are evaluated. Then, for each enabled map, it is as if a corresponding GL command were issued with the resulting coordinates, with one important difference. The difference is that when an evaluation is performed, the GL uses evaluated values instead of current values for those evaluations that are enabled (otherwise, the current values are used). The order of the effective commands is immaterial, except that Vertex (for vertex coordinate evaluation) must be issued last. Use of evaluators has no effect on the current color, normal, or texture coordinates. If ColorMaterial is enabled, evaluated color values affect the result of the lighting equation as if the current color was being modified, but no change is made to the tracking lighting parameters or to the current color. No command is effectively issued if the corresponding map (of the indicated dimension) is not enabled. If more than one evaluation is enabled for a particular dimension (e.g. MAP1_TEXTURE_COORD_1 and MAP1_TEXTURE_COORD_2), then only the result of the evaluation of the map with the highest number of coordinates is used. Finally, if either MAP2_VERTEX_3 or MAP2_VERTEX_4 is enabled, then the normal to the surface is computed. Analytic computation, which sometimes yields normals of length zero is one method which may be used. If automatic normal generation is enabled, then this computed normal is used as the normal associated with a generated vertex. Automatic normal generation is controlled with Enable and Disable with symbolic the constant AUTO_NORMAL. If automatic normal generation is disabled, then a corresponding normal map, if enabled, is used to produce a normal. If neither automatic normal generation nor a normal map are enabled, then no normal is sent with a vertex resulting from an evaluation (the effect is that the current normal is used).
For MAP_VERTEX_3, let
Then the generated analytic normal, The second way to carry out evaluations is to use a set of commands that provide for efficient specification of a series of evenly spaced values to be mapped. This method proceeds in two steps. The first step is to define a grid in the domain. This is done using
void MapGrid1[fd] ( int n, T for a 1-dimensional map or
void MapGrid2[fd] ( int
for a 2-dimensional map.
In the case of MapGrid1
Once a grid is defined, an evaluation on a rectangular subset of that grid may be carried out by calling
void EvalMesh1 ( enum mode, int
mode is either POINT or LINE.
The effect is the same as performing the following code fragment,
with
where EvalCoord1f or EvalCoord1d
is substituted for EvalCoord1 as appropriate.
If mode is POINT, then type is POINTS;
if mode is LINE, then type is LINE_STRIP.
The one requirement is that if either i=0 or i=n,
then the value computed from The corresponding commands for two-dimensional maps are
void EvalMesh2 ( enum mode, int
mode must be FILL, LINE, or POINT.
When mode is FILL,
then
these commands are equivalent to the following,
with If mode is LINE, then a call to EvalMesh2 is equivalent to If mode is POINT, then a call to EvalMesh2 is equivalent to
Again, in all three cases,
there is the requirement that
An evaluation of a single point on the grid may also be carried out: Calling it is equivalent to the command
with
void EvalPoint2 ( int p, int q ) ; is equivalent to the command
The state required for evaluators potentially consists of 9 1-dimensional
map specifications and 9 2-dimensional map specifications,
as well as corresponding flags for each specification indicating
which are enabled.
Each map specification consists of one or two orders,
an appropriately sized array of control points,
and a set of two values (for a 1-dimensional map) or four values (for
a 2-dimensional map) to describe the domain.
The maximum possible order, for either u or v,
is implementation dependent (one maximum applies to both u and v),
but must be at least 8.
Each control point consists of between one and four
floating-point values (depending on the type of the map).
Initially,
all maps have order 1 (making them constant maps).
All vertex coordinate maps produce the coordinates
![]() ![]() ![]() ![]() ![]() Next: 5.2 Selection Up: 5 Special Functions Previous: 5 Special Functions David Blythe Sat Mar 29 02:23:21 PST 1997
|