gl.EvalMesh(mode, i1, i2[, j1, j2])
gl.MapGrid() and gl.EvalMesh()
are used in tandem to efficiently generate
and evaluate a series of evenly spaced map domain values. gl.EvalMesh()
steps through the
integer domain of a one- or two-dimensional grid, whose range is the domain of the evaluation
maps specified by gl.Map(). mode
determines whether the resulting vertices
are connected as points, lines, or filled polygons (the latter is only supported for two-dimensional
grids). In the one-dimensional case, gl.EvalMesh()
, the mesh is generated as if the following code
fragment were executed:
gl.Begin(type) For Local i = i1 To i2 Do gl.EvalCoord(i*du+u1) gl.End() |
where du = (u2-u1)/n and n, u1, and u2 are the arguments to the most recent gl.MapGrid() command.
type
is #GL_POINTS
if mode is #GL_POINT
, or #GL_LINES
if mode is #GL_LINE
. The one absolute numeric requirement is
that if i = n, then the value computed from i*du+u1 is exactly u2.
In the two-dimensional case, gl.EvalMesh()
, let
du = (u2-u1)/n dv = (v2-v1)/m, |
where n, u1, u2, m, v1, and v2 are the arguments to the most recent gl.MapGrid() command.
Then, if mode is #GL_FILL
, the gl.EvalMesh()
command is equivalent to:
For Local j = j1 To j2 - 1 gl.Begin(#GL_QUAD_STRIP) For Local i = i1 To i2 gl.EvalCoord(i*du+u1, j*dv+v1) gl.EvalCoord(i*du+u1, (j+1)*dv+v1) Next gl.End() Next |
If mode is #GL_LINE
, then a call to gl.EvalMesh()
is equivalent to:
For Local j = j1 To j2 gl.Begin(#GL_LINE_STRIP) For Local i = i1 To i2 gl.EvalCoord(i*du+u1, j*dv+v1) Next gl.End() Next For Local i = i1 To i2 gl.Begin(#GL_LINE_STRIP) For Local j = j1 To j2 gl.EvalCoord(i*du+u1, j*dv+v1) Next gl.End() Next |
And finally, if mode is #GL_POINT
, then a call to gl.EvalMesh()
is equivalent to:
gl.Begin(#GL_POINTS) For Local j = j1 To j2 For Local i = i1 To i2 gl.EvalCoord(i*du+u1, j*dv+v1) Next Next gl.End() |
In all three cases, the only absolute.numeric requirements are that if i = n, then the value computed from i*du+u1 is exactly u2, and if j = m, then the value computed from j*dv+v1 is exactly v2.
Please consult an OpenGL reference manual for more information.
#GL_POINT
, #GL_LINE
, and in case of a two-dimensional mesh, #GL_FILL
are accepted#GL_INVALID_ENUM
is generated if mode
is not an accepted value.
#GL_INVALID_OPERATION
is generated if gl.EvalMesh()
is executed between the execution of gl.Begin() and the corresponding execution of gl.End() .
#GL_MAP1_GRID_DOMAIN
gl.Get() with argument #GL_MAP2_GRID_DOMAIN
gl.Get() with argument #GL_MAP1_GRID_SEGMENTS
gl.Get() with argument #GL_MAP2_GRID_SEGMENTS