Open GL Super Bible:Curves and Surfaces: What the #%@!&* Are NURBS?
To access the contents, click the chapter and section titles.
Open GL Super Bible
(Publisher: Macmillan Computer Publishing)
Author(s): Waite group Press
ISBN: 1571690735
Publication Date: 08/01/96
Previous Table of Contents Next
glEvalMesh
Purpose Computes a 1D or 2D grid of points or lines. Include File <gl.h> Variations void glEvalMesh1(GLenum mode, GLint i1, GLint i2);
void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); Description This function is used with glMapGrid to efficiently create a mesh of evenly spaced u and v domain values. glEvalMesh actually evaluates the mesh and produces the points, line segments, or filled polygons.
Parameters
mode
GLdouble: Specifies whether the mesh should be computed as points (GL_POINT), lines (GL_LINE), or filled meshes for surfaces (GL_FILL). i1,i2
GLint: Specifies the first and last integer values for the u domain. j1,j2
GLint: Specifies the first and last integer values for the v domain. Returns None.
Example The following code from the BEZIER example program creates a grid map from 0 to 100 with 100 partitions. The call to glEvalMesh then evaluates the grid and draws line segments between each point on the curve.
// Use higher level functions to map to a grid, then evaluate the // entire thing.
// Map a grid of 100 points from 0 to 100 glMapGrid1d(100,0.0,100.0);
// Evaluate the grid, using lines glEvalMesh1(GL_LINE,0,100);
See Also glBegin, glEvalCoord, glEvalPoint, glMap1, glMap2, glMapGrid
glEvalPoint
Purpose Generates and evaluates a single point in a mesh. Include File <gl.h> Variations void glEvalPoint1(GLint i);
voidglEvalPoint2(GLint i, GLint j); Description This function can be used in place of glEvalMesh to evaluate a domain at a single point. The evaluation produces a single primitive, GL_POINTS. The first variation (glEvalPoint1) is used for curves, and the second (glEvalPoint2) is for surfaces.
Parameters
i,j
GLint: Specifies the u and v domain parametric values. Returns None.
Example The following code renders the Bazier curve in the example program BEZIER as a series of points rather than line segments. Here we have commented out the code that is no longer needed from the previous example for glEvalCoord.
// Use a line strip to "connect the dots" // glBegin(GL_LINE_STRIP); for(i = 0; i <= 100; i++) { // Evaluate the curve at this point //glEvalCoord1f((GLfloat) i); glEvalPoint1(i); } // glEnd();
See Also glEvalCoord, glEvalMesh, glMap1, glMap2, glMapGrid
void glGetMapiv(GLenum target, GLenum query, GLint *v); Description This function retrieves map settings that were set by the glMap functions. See glMap1 and glMap2 in this section for explanations of the types of maps.
Parameters
target
GLenum: The name of the map; the following maps are defined:
GL_MAP2_VERTEX_4. See glMap in this section for an explanation of these map types. query
GLenum: Specifies which map parameter to return in *v. May be one of the following values:
GL_COEFF : Returns an array containing the control points for the map. Coordinates are returned in row-major order. 1D maps return order control points, and 2D maps return u-order times the v-order control points.
GL_ORDER: Returns the order of the evaluator function. For 1D maps, this is a single value. For 2D maps, two values are returned (an array) that contain first the u-order, then the v-order.
GL_DOMAIN: Returns the linear parametric mapping parameters. For 1D evaluators, this is the lower and upper u value. For 2D maps, itłs lower and upper u followed by lower and upper v. *v
Pointer to storage that will contain the requested parameter. The data type of this storage should match the function used (double, float, or integer). Returns None.
Example The following code shows mapping parameters being designated and later retrieved (probably in another function). In comments we show the contents of the buffer.
glMap2f(GL_MAP2_VERTEX_3, // Type of data generated 0.0f, // Lower u range 10.0f, // Upper u range 3, // Distance between points in the data 3, // Dimension in u direction (order) 0.0f, // Lower v range 10.0f, // Upper v range 9, // Distance between points in the data 3, // Dimension in v direction (order) &ctrlPoints[0][0][0]); // array of control points