Computes a one-dimensional (1D) or two-dimensional (2D) grid of points or lines.
OpenGL C bindings library: libGL.a
void glEvalMesh1(GLenum Mode, GLint i1, GLint i2)
void glEvalMesh2(GLenum Mode, GLint i1, GLint i2, GLint j1, GLint j2)
The glMapGrid and glEvalMesh subroutines are used in tandem to efficiently generate and evaluate a series of evenly spaced map domain values. The glEvalMesh subroutine steps through the integer domain of a 1D or 2D grid whose range is the domain of the evaluation maps specified by glMap1 and glMap2. The Mode parameter determines whether the resulting vertices are connected as points, lines, or filled polygons.
In the 1D case, glEvalMesh1, the mesh is generated as if the following code fragment was executed:
glBegin(Type); for (i = i1; i <= i2; i += 1) glEvalCoord1(i (DELTA u) + u1) glEnd();
where DELTA u = (u2 - u1 )/n and n, u1, and u2 are the arguments to the most recent glMapGrid1 subroutine. 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, the value computed from i (DELTA u) + u1 is exactly u2.
In the 2D case, glEvalMesh2, DELTA u = (u2 - u1)/n and DELTA v = (v2 - v1)/m, where n, u1, u2, m, v1, and v2 are the arguments to the most recent glMapGrid2 subroutine. Then, if Mode is GL_FILL, the glEvalMesh2 subroutine is equivalent to:
for (j = j1; j < j2; j += 1) { glBegin(GL_QUAD_STRIP) for (i= i1; i <= i2; i += 1) { glEvalCoord2(i (DELTA u) + u1, j (DELTA v) + v1); glEvalCoord2(i (DELTA u) + u1, (j+1) (DELTA v) + v1); } glEnd(); }
If Mode is GL_LINE, a call to glEvalMesh2 is equivalent to:
for (j = j1; j <= j2; j += 1) { glBegin(GL_LINE_STRIP) for (i = i1; i <= i2; i += 1) glEvalCoord2(i DELTA u + u1, j (DELTA v) + v1); glEnd(); } for (i = i1; i <= i2; i += 1) { glBegin(GL_LINE_STRIP); for (j = j1; j <= j1; j += 1) glEvalCoord2(i (DELTA u + u1, j (DELTA v) + v1); glEnd(); }
And finally, if Mode is GL_POINT, a call to glEvalMesh2 is equivalent to:
glBegin(GL_POINTS); for (j = j1; j <= j2; j += 1) { for (i = i1; i <= i2; i += 1) { glEvalCoord2(i (DELTA u) + u1, j (DELTA v) + v1): } } glEnd();
In all three cases, the only absolute numeric requirements are that if i = n, the value computed from i (DELTA u) + u1 is exactly u2, and if j = m, the value computed from j (DELTA v) + v1 is exactly v2.
GL_INVALID_ENUM | Indicates that Mode is not an accepted value. |
GL_INVALID_OPERATION | Indicates that glEvalMesh is called between a call to glBegin and the corresponding call to glEnd. |
Associated gets for the glEvalMesh subroutine are as follows. (See the glGet subroutine for more information.)
glGet with argument GL_MAP1_GRID_DOMAIN
glGet with argument GL_MAP2_GRID_DOMAIN
glGet with argument GL_MAP1_GRID_SEGMENTS
glGet with argument GL_MAP2_GRID_SEGMENTS.
/usr/include/GL/gl.h | Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |
The glBegin or glEnd subroutine, glEvalCoord subroutine, glEvalPoint subroutine, glMap1 subroutine, glMap2 subroutine, glMapGrid subroutine.