glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f

These functions define a one- or two-dimensional mesh.

void glMapGrid1d(
  GLint un,     
  GLdouble u1,  
  GLdouble u2   
);
 
void glMapGrid1f(
  GLint un,    
  GLfloat u1,  
  GLfloat u2   
);
 
void glMapGrid2d(
  GLint un,     
  GLdouble u1,  
  GLdouble u2,  
  GLint vn,     
  GLdouble v1,  
  GLdouble v2   
);
 
void glMapGrid2f(
  GLint un,    
  GLfloat u1,  
  GLfloat u2,  
  GLint vn,    
  GLfloat v1,  
  GLfloat v2   
);
 

Parameters

un
The number of partitions in the grid range interval [u1, u2]. Must be positive.
u1, u2
The mappings for integer grid domain values = 0 and un.
vn
The number of partitions in the grid range interval [v1v2] (glMapGrid2 only).
v1, v2
The mappings for integer grid domain values j = 0 and j = vn (glMapGrid2 only).

Remarks

The glMapGrid and glEvalMesh functions are used in tandem to efficiently generate and evaluate a series of evenly spaced map domain values. The glEvalMesh function steps through the integer domain of a one- or two-dimensional grid, whose range is the domain of the evaluation maps specified by glMap1 and glMap2.

The glMapGrid1 and glMapGrid2 functions specify the linear grid mappings between the i (or i and j) integer grid coordinates, to the u (or u and v) floating-point evaluation map coordinates. See glMap1 and glMap2 for details of how u and v coordinates are evaluated.

The glMapGrid1 function specifies a single linear mapping such that integer grid coordinate 0 maps exactly to u1, and integer grid coordinate un maps exactly to u2. All other integer grid coordinates i are mapped such that:

u = i(u2 – u1)/un + u1

The glMapGrid2 function specifies two such linear mappings. One maps integer grid coordinate = 0 exactly to u1, and integer grid coordinate un exactly to u2. The other maps integer grid coordinate = 0 exactly to v1, and integer grid coordinate vn exactly to v2. Other integer grid coordinates i and j are mapped such that

u = i(u2 – u1)/un + u1

v = j (v2 – v1)/vn + v1

The mappings specified by glMapGrid are used identically by glEvalMesh and glEvalPoint.

The following functions retrieve information related to glMapGrid:

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

Error Codes

The following are the error codes generated and their conditions.

Error Code Condition
GL_INVALID_VALUE Either un or vn was not positive.
GL_INVALID_OPERATION glMapGrid was called between a call to glBegin and the corresponding call to glEnd.

QuickInfo

  Windows NT: Use version 3.5 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in gl.h.
  Import Library: Link with opengl32.lib.

See Also

glBegin, glEnd, glEvalCoord, glEvalMesh, glEvalPoint, glMap1, glMap2