GLMAP2(3G)
โจ NAME โจ
okay so bestie, welcome to GLMAP2(3G) ๐ โ the page for glMap2d and glMap2f, and what they do is define a two-dimensional evaluator. that's it. that's the whole vibe. ๐ฆ
๐ C SPECIFICATION ๐
void glMap2d( GLenum target,
GLdouble u1,
GLdouble u2,
GLint ustride,
GLint uorder,
GLdouble v1,
GLdouble v2,
GLint vstride,
GLint vorder,
const GLdouble *points )
void glMap2f( GLenum target,
GLfloat u1,
GLfloat u2,
GLint ustride,
GLint uorder,
GLfloat v1,
GLfloat v2,
GLint vstride,
GLint vorder,
const GLfloat *points )
๐ธ PARAMETERS ๐ธ
targetโ tells the evaluator what kind of values it's gonna spit out. the accepted glow-up constants areGL_MAP2_VERTEX_3,GL_MAP2_VERTEX_4,GL_MAP2_INDEX,GL_MAP2_COLOR_4,GL_MAP2_NORMAL,GL_MAP2_TEXTURE_COORD_1,GL_MAP2_TEXTURE_COORD_2,GL_MAP2_TEXTURE_COORD_3, andGL_MAP2_TEXTURE_COORD_4. all nine, bestie, no skips. ๐u1,u2โ these set up a linear mapping ofu, the way it shows up when you hand it toglEvalCoord2, ontouโ anduis one of the two variables that get evaluated by the equations this command defines. initial tea:u1is0andu2is1. ๐ustrideโ the number of floats or doubles between the start of control pointRijand the start of control pointR(i+1)j, whereiandjare the u and v control point indices, respectively. this is the little trick that lets control points live embedded in arbitrary data structures. the only rule? the values for one particular control point have to sit in contiguous memory locations, periodt.ustridestarts life at0. โจuorderโ the dimension of the control point array along the u axis. must be positive. initial value is1. ๐v1,v2โ same energy asu1/u2but forv: a linear mapping ofv, as presented toglEvalCoord2, ontov, one of the two variables evaluated by the equations this command specifies. initiallyv1is0andv2is1. ๐vstrideโ the number of floats or doubles between the start of control pointRijand the start of control pointRi(j+1), whereiandjare the u and v control point indices, respectively. yes it also lets control points be embedded in arbitrary data structures, and yes the only constraint is that a particular control point's values must occupy contiguous memory locations. initial value is0. ๐vorderโ the dimension of the control point array along the v axis. must be positive. initial value is1. โญpointsโ a pointer to the array of control points. iconic. ๐
๐ DESCRIPTION ๐
Evaluators are the moment where you get to use polynomial or rational polynomial mapping to produce vertices, normals, texture coordinates, and colors. the values an evaluator produces get sent onward through the later stages of GL processing exactly as if you'd handed them over with glVertex, glNormal, glTexCoord, and glColor commands โ with one lil caveat: the generated values do not update the current normal, texture coordinates, or color. they just pass through, no commitment. ๐
Every polynomial or rational polynomial spline of any degree (up to the maximum degree your GL implementation supports) can be described using evaluators. that covers basically almost all surfaces used in computer graphics โ B-spline surfaces, NURBS surfaces, Bezier surfaces, and so on. all of them. obsessed. ๐ฅ
Evaluators define surfaces based on bivariate Bernstein polynomials. define p(u,v) as:
p(u,v)=iฮฃ0jฮฃ0Bi(u)Bj(v)Rij
where Rij is a control point, Bi(u) is the ith Bernstein polynomial of degree n (uorder = n+1):
Bi(u)=โnโ ui(1โu)nโi
i
and Bj(v) is the jth Bernstein polynomial of degree m (vorder = m+1):
Bj(v)=โmโ vj(1โv)mโj
j
and recall that:
00โก1 and โnโ โก1
0
glMap2 is what you use to define the basis and to say what kind of values get produced. once a map is defined, you can enable and disable it by calling glEnable and glDisable with the map name โ one of the nine predefined values for target, described below. when glEvalCoord2 presents values u and v, the bivariate Bernstein polynomials get evaluated using u and v, where:
u=_____
v=_____
target is a symbolic constant that says what kind of control points you're handing over in points, and what output gets generated when the map is evaluated. it can be one of nine predefined values, and here's the whole lineup, no gatekeeping:
GL_MAP2_VERTEX_3โ each control point is three floating-point values representingx,y, andz. internalglVertex3commands are generated when the map is evaluated. ๐GL_MAP2_VERTEX_4โ each control point is four floating-point values representingx,y,z, andw. internalglVertex4commands are generated when the map is evaluated. ๐GL_MAP2_INDEXโ each control point is a single floating-point value representing a color index. internalglIndexcommands are generated when the map is evaluated, but the current index is not updated with the value of thoseglIndexcommands. ๐GL_MAP2_COLOR_4โ each control point is four floating-point values representing red, green, blue, and alpha. internalglColor4commands are generated when the map is evaluated, but the current color is not updated with the value of thoseglColor4commands. ๐จGL_MAP2_NORMALโ each control point is three floating-point values representing thex,y, andzcomponents of a normal vector. internalglNormalcommands are generated when the map is evaluated, but the current normal is not updated with the value of thoseglNormalcommands. โญGL_MAP2_TEXTURE_COORD_1โ each control point is a single floating-point value representing thestexture coordinate. internalglTexCoord1commands are generated when the map is evaluated, but the current texture coordinates are not updated with the value of thoseglTexCoordcommands. ๐งตGL_MAP2_TEXTURE_COORD_2โ each control point is two floating-point values representing thesandttexture coordinates. internalglTexCoord2commands are generated when the map is evaluated, but the current texture coordinates are not updated with the value of thoseglTexCoordcommands. ๐งGL_MAP2_TEXTURE_COORD_3โ each control point is three floating-point values representing thes,t, andrtexture coordinates. internalglTexCoord3commands are generated when the map is evaluated, but the current texture coordinates are not updated with the value of thoseglTexCoordcommands. โจGL_MAP2_TEXTURE_COORD_4โ each control point is four floating-point values representing thes,t,r, andqtexture coordinates. internalglTexCoord4commands are generated when the map is evaluated, but the current texture coordinates are not updated with the value of thoseglTexCoordcommands. ๐ธ
ustride, uorder, vstride, vorder, and points are what define the array addressing for accessing the control points. points is the location of the first control point, which occupies one, two, three, or four contiguous memory locations โ depending on which map you're defining. there are uorderรvorder control points in the array. ustride says how many float or double locations get skipped to advance the internal memory pointer from control point Rij to control point R(i+1)j. vstride says how many float or double locations get skipped to advance the internal memory pointer from control point Rij to control point Ri(j+1). math is math, bestie. ๐งฎ
๐ NOTES ๐
like with all GL commands that take pointers to data, it's as if the contents ofpointswere copied byglMap2beforeglMap2returns. changes to the contents ofpointshave no effect afterglMap2is called. so don't be out here editing that array afterwards expecting the map to care. it won't. ๐
initially, GL_AUTO_NORMAL is enabled. if GL_AUTO_NORMAL is enabled, normal vectors get generated when either GL_MAP2_VERTEX_3 or GL_MAP2_VERTEX_4 is used to generate vertices. automatic. main character behavior. ๐
๐จ ERRORS ๐จ
GL_INVALID_ENUMis generated iftargetis not an accepted value. ๐ซGL_INVALID_VALUEis generated ifu1is equal tou2, or ifv1is equal tov2. ๐ญGL_INVALID_VALUEis generated if eitherustrideorvstrideis less than the number of values in a control point. ๐GL_INVALID_VALUEis generated if eitheruorderorvorderis less than1or greater than the return value ofGL_MAX_EVAL_ORDER. ๐GL_INVALID_OPERATIONis generated ifglMap2is executed between the execution ofglBeginand the corresponding execution ofglEnd. ๐ท- when the
GL_ARB_multitextureextension is supported,GL_INVALID_OPERATIONis generated ifglMap2is called and the value ofGL_ACTIVE_TEXTURE_ARBis notGL_TEXTURE0_ARB. ๐ฏ
๐ ASSOCIATED GETS ๐
the stuff you can peek at to check on all this:
glGetMapglGetwith argumentGL_MAX_EVAL_ORDERglIsEnabledwith argumentGL_MAP2_VERTEX_3glIsEnabledwith argumentGL_MAP2_VERTEX_4glIsEnabledwith argumentGL_MAP2_INDEXglIsEnabledwith argumentGL_MAP2_COLOR_4glIsEnabledwith argumentGL_MAP2_NORMALglIsEnabledwith argumentGL_MAP2_TEXTURE_COORD_1glIsEnabledwith argumentGL_MAP2_TEXTURE_COORD_2glIsEnabledwith argumentGL_MAP2_TEXTURE_COORD_3glIsEnabledwith argumentGL_MAP2_TEXTURE_COORD_4
๐ SEE ALSO ๐
go read these next, bestie, they're all in the group chat:
glBegin(3G), glColor(3G), glEnable(3G), glEvalCoord(3G), glEvalMesh(3G), glEvalPoint(3G), glMap1(3G), glMapGrid(3G), glNormal(3G), glTexCoord(3G), glVertex(3G)
and that's the whole page, you made it to the end ๐ซถ this was GLMAP2(3G) from the 3G manual section โ same name up at the top, same name down at the bottom, as is tradition. slay ๐ ๐
๐ฆ 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