GLEVALMESH(3G)
π
GLEVALMESH β the 3G glow-up π
ok bestie, we're doing glEvalMesh1 and glEvalMesh2 today, and honestly? they're lowkey iconic. they compute a one- or two-dimensional grid of points or lines. that's the whole vibe. let's get into it β¨
β¨ C SPECIFICATION β¨
void glEvalMesh1( GLenum mode,
GLint i1,
GLint i2 )
πΈ PARAMETERS πΈ
modeβ inglEvalMesh1, this tells us whether we're computing a one-dimensional mesh of points or lines. the symbolic constantsGL_POINTandGL_LINEare the accepted ones, periodt.i1,i2β the first and last integer values for grid domain variablei. yes bestie, the domain variable is literally calledi, we love a lowercase moment π
π C SPECIFICATION (the sequel) π
void glEvalMesh2( GLenum mode,
GLint i1,
GLint i2,
GLint j1,
GLint j2 )
π¦ PARAMETERS π¦
modeβ inglEvalMesh2, this says whether we're computing a two-dimensional mesh of points, lines, or polygons. the symbolic constantsGL_POINT,GL_LINE, andGL_FILLare accepted here, no cap.i1,i2β first and last integer values for grid domain variablei.j1,j2β first and last integer values for grid domain variablej. (yes,iandj, the classic duo, main character energy fr fr)
π DESCRIPTION π
okay so here's the tea: glMapGrid and glEvalMesh are used in tandem to efficiently generate and evaluate a series of evenly-spaced map domain values. that's their whole thing. glEvalMesh steps through the integer domain of a one- or two-dimensional grid, and that grid's range is the domain of the evaluation maps that glMap1 and glMap2 specify. then mode decides whether the resulting vertices get connected as points, lines, or filled polygons. slay.
π the 1D case π
in the one-dimensional case, glEvalMesh1, the mesh is generated as if this exact code fragment were executed:
glBegin( type );
for ( i = i1; i <= i2; i += 1 )
glEvalCoord1( iβ
Ξu+u1 );
glEnd();
where
Ξu=(u2βu1)/n
and n, u1, and u2 are the arguments to the most recent glMapGrid1 command. type is GL_POINTS if mode is GL_POINT, or GL_LINES if mode is GL_LINE. π«Ά
the one absolute numeric requirement β like, the ONE thing you cannot mess up β is that if i=n, then the value computed from iβ
Ξu+u1 is exactly u2. exactly. not "close enough". exactly. π
π§ the 2D case π§
in the two-dimensional case, glEvalMesh2, let
Ξu=(u2βu1)/n
Ξv=(v2βv1)/m,
where n, u1, u2, m, v1, and v2 are the arguments to the most recent glMapGrid2 command. then, if mode is GL_FILL, the glEvalMesh2 command is equivalent to:
for ( j = j1; j < j2; j += 1 ) {
glBegin( GL_QUAD_STRIP );
for ( i = i1; i <= i2; i += 1 ) {
glEvalCoord2( iβ
Ξu+u1, jβ
Ξv+v1 );
glEvalCoord2( iβ
Ξu+u1, (j+1)β
Ξv+v1 );
}
glEnd();
}
if mode is GL_LINE, then 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β
Ξu+u1, jβ
Ξv+v1 );
glEnd();
}
for ( i = i1; i <= i2; i += 1 ) {
glBegin( GL_LINE_STRIP );
for ( j = j1; j <= j1; j += 1 )
glEvalCoord2( iβ
Ξu+u1, jβ
Ξv+v1 );
glEnd();
}
and finally, if mode is GL_POINT, then 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β
Ξu+u1, jβ
Ξv+v1 );
glEnd();
in all three cases, the only absolute numeric requirements are that if i=n, then the value computed from iβ
Ξu+u1 is exactly u2, and if j=m, then the value computed from jβ
Ξv+v1 is exactly v2. that's it, that's the standard, don't come for me π
π ERRORS π
GL_INVALID_ENUMis generated ifmodeis not an accepted value. bestie. pick a valid one.GL_INVALID_OPERATIONis generated ifglEvalMeshis executed between the execution ofglBeginand the corresponding execution ofglEnd. so like... do NOT do that. it's giving illegal. π
real talk:glBegin/glEndis a closed set. you cannot slip anglEvalMeshin the middle. the GL will simply say no. π
π ASSOCIATED GETS π
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
β SEE ALSO β
glBegin(3G), glEvalCoord(3G), glEvalPoint(3G), glMap1(3G), glMap2(3G), glMapGrid(3G)
and that's the whole page, bestie π«Ά this was the GLEVALMESH(3G) manual page from the 3G (OpenGL) section β signed, sealed, and delivered with all the original source and date energy intact. now go evaluate a mesh, you gorgeous genius πβ¨π
π¦ where this page comes from
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms