GLEVALMESH(3G)

πŸ“¦ version 1.1, in centos-stream 9, fedora 43, fedora 44

πŸ’… 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 β€” in glEvalMesh1, this tells us whether we're computing a one-dimensional mesh of points or lines. the symbolic constants GL_POINT and GL_LINE are the accepted ones, periodt.
  • i1, i2 β€” the first and last integer values for grid domain variable i. yes bestie, the domain variable is literally called i, we love a lowercase moment πŸ’–

πŸ’œ C SPECIFICATION (the sequel) πŸ’œ

void glEvalMesh2( GLenum mode,
                  GLint i1,
                  GLint i2,
                  GLint j1,
                  GLint j2 )

πŸ¦‹ PARAMETERS πŸ¦‹

  • mode β€” in glEvalMesh2, this says whether we're computing a two-dimensional mesh of points, lines, or polygons. the symbolic constants GL_POINT, GL_LINE, and GL_FILL are accepted here, no cap.
  • i1, i2 β€” first and last integer values for grid domain variable i.
  • j1, j2 β€” first and last integer values for grid domain variable j. (yes, i and j, 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_ENUM is generated if mode is not an accepted value. bestie. pick a valid one.
  • GL_INVALID_OPERATION is generated if glEvalMesh is executed between the execution of glBegin and the corresponding execution of glEnd. so like... do NOT do that. it's giving illegal. πŸ™ˆ
real talk: glBegin / glEnd is a closed set. you cannot slip an glEvalMesh in 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