GLPIXELMAP(3G)
πΈ GLPIXELMAP β the GLPIXELMAP(3G) glow-up β¨
okay so bestie, welcome to the pixel map page π this is the one where OpenGL lets you build your little translation tables. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
glPixelMapfv, glPixelMapuiv, glPixelMapusv β set up pixel transfer maps π
π C SPECIFICATION π
no cap, here's exactly what you call:
void glPixelMapfv( GLenum map,
GLint mapsize,
const GLfloat *values )
void glPixelMapuiv( GLenum map,
GLint mapsize,
const GLuint *values )
void glPixelMapusv( GLenum map,
GLint mapsize,
const GLushort *values )
π¦ PARAMETERS π¦
mapβ the symbolic map name, periodt. It has to be one of these and nothing else:GL_PIXEL_MAP_I_TO_I,GL_PIXEL_MAP_S_TO_S,GL_PIXEL_MAP_I_TO_R,GL_PIXEL_MAP_I_TO_G,GL_PIXEL_MAP_I_TO_B,GL_PIXEL_MAP_I_TO_A,GL_PIXEL_MAP_R_TO_R,GL_PIXEL_MAP_G_TO_G,GL_PIXEL_MAP_B_TO_B, orGL_PIXEL_MAP_A_TO_A.mapsizeβ how big the map you're defining is, literally the size bestie.valuesβ an array ofmapsizevalues. that's it, that's the whole vibe.
π DESCRIPTION π
so glPixelMap sets up translation tables (aka maps) that get used by glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glDrawPixels, glReadPixels, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, and glTexSubImage3D. π
and ALSO, if the GL_ARB_imaging subset is supported, these routines too: glColorTable, glColorSubTable, glConvolutionFilter1D, glConvolutionFilter2D, glHistogram, glMinmax, and glSeparableFilter2D.
the way these maps actually get used is fully described over in the glPixelTransfer reference page, and partially in the reference pages for the pixel and texture image commands. this page? this page is ONLY about specifying the maps. no more, no less. π
so: map is a symbolic map name, and it picks which one of the ten maps you're setting. mapsize is the number of entries in the map, and values is a pointer to an array of mapsize map values.
the ten maps, iconic lineup, no skips:
GL_PIXEL_MAP_I_TO_Iβ maps color indices to color indices.GL_PIXEL_MAP_S_TO_Sβ maps stencil indices to stencil indices.GL_PIXEL_MAP_I_TO_Rβ maps color indices to red components.GL_PIXEL_MAP_I_TO_Gβ maps color indices to green components.GL_PIXEL_MAP_I_TO_Bβ maps color indices to blue components.GL_PIXEL_MAP_I_TO_Aβ maps color indices to alpha components.GL_PIXEL_MAP_R_TO_Rβ maps red components to red components.GL_PIXEL_MAP_G_TO_Gβ maps green components to green components.GL_PIXEL_MAP_B_TO_Bβ maps blue components to blue components.GL_PIXEL_MAP_A_TO_Aβ maps alpha components to alpha components.
okay now the entries themselves β you can specify them as single-precision floating-point numbers, unsigned short integers, or unsigned long integers. pick your fighter.
maps that store color component values (that's all of them except GL_PIXEL_MAP_I_TO_I and GL_PIXEL_MAP_S_TO_S) keep their values in floating-point, with unspecified mantissa and exponent sizes π. floating-point values you pass to glPixelMapfv get converted directly into the internal floating-point of these maps, then clamped to the range [0,1]. unsigned integer values from glPixelMapusv and glPixelMapuiv get converted linearly, so the largest representable integer maps to 1.0, and 0 maps to 0.0. math ate, honestly π
maps that store indices, aka GL_PIXEL_MAP_I_TO_I and GL_PIXEL_MAP_S_TO_S, keep their values in fixed-point, with an unspecified number of bits to the right of the binary point. floating-point values from glPixelMapfv are converted directly to the internal fixed-point of these maps. unsigned integer values from glPixelMapusv and glPixelMapuiv specify integer values, with all 0's to the right of the binary point. π§
π initial sizes and values π
here's the starter pack β the initial sizes and values for every map:
GL_PIXEL_MAP_I_TO_Iβ lookup index: color index; lookup value: color index; initial size1; initial value0GL_PIXEL_MAP_S_TO_Sβ lookup index: stencil index; lookup value: stencil index; initial size1; initial value0GL_PIXEL_MAP_I_TO_Rβ lookup index: color index; lookup value:R; initial size1; initial value0GL_PIXEL_MAP_I_TO_Gβ lookup index: color index; lookup value:G; initial size1; initial value0GL_PIXEL_MAP_I_TO_Bβ lookup index: color index; lookup value:B; initial size1; initial value0GL_PIXEL_MAP_I_TO_Aβ lookup index: color index; lookup value:A; initial size1; initial value0GL_PIXEL_MAP_R_TO_Rβ lookup index:R; lookup value:R; initial size1; initial value0GL_PIXEL_MAP_G_TO_Gβ lookup index:G; lookup value:G; initial size1; initial value0GL_PIXEL_MAP_B_TO_Bβ lookup index:B; lookup value:B; initial size1; initial value0GL_PIXEL_MAP_A_TO_Aβ lookup index:A; lookup value:A; initial size1; initial value0
β οΈ bestie listen. maps that are indexed by either color or stencil indices MUST havemapsize = 2nfor somen, or the results are undefined. undefined. we don't do undefined in this house. π
the maximum allowable size for each map depends on the implementation, and you can find it out by calling glGet with argument GL_MAX_PIXEL_MAP_TABLE. that single maximum applies to all the maps, and it's at least 32. lowkey generous, highkey the floor. π
π ERRORS π
GL_INVALID_ENUMis generated ifmapis not an accepted value. (rude, but okay)GL_INVALID_VALUEis generated ifmapsizeis less than one or larger thanGL_MAX_PIXEL_MAP_TABLE.GL_INVALID_VALUEis generated ifmapisGL_PIXEL_MAP_I_TO_I,GL_PIXEL_MAP_S_TO_S,GL_PIXEL_MAP_I_TO_R,GL_PIXEL_MAP_I_TO_G,GL_PIXEL_MAP_I_TO_B, orGL_PIXEL_MAP_I_TO_A, andmapsizeis not a power of two. π«GL_INVALID_OPERATIONis generated ifglPixelMapis executed between the execution ofglBeginand the corresponding execution ofglEnd. just don't do it babe.
π₯ ASSOCIATED GETS π₯
glGetPixelMapglGetwith argumentGL_PIXEL_MAP_I_TO_I_SIZEglGetwith argumentGL_PIXEL_MAP_S_TO_S_SIZEglGetwith argumentGL_PIXEL_MAP_I_TO_R_SIZEglGetwith argumentGL_PIXEL_MAP_I_TO_G_SIZEglGetwith argumentGL_PIXEL_MAP_I_TO_B_SIZEglGetwith argumentGL_PIXEL_MAP_I_TO_A_SIZEglGetwith argumentGL_PIXEL_MAP_R_TO_R_SIZEglGetwith argumentGL_PIXEL_MAP_G_TO_G_SIZEglGetwith argumentGL_PIXEL_MAP_B_TO_B_SIZEglGetwith argumentGL_PIXEL_MAP_A_TO_A_SIZEglGetwith argumentGL_MAX_PIXEL_MAP_TABLE
π«Ά SEE ALSO π«Ά
glColorTable(3G), glColorSubTable(3G), glConvolutionFilter1D(3G), glConvolutionFilter2D(3G), glCopyPixels(3G), glCopyTexImage1D(3G), glCopyTexImage2D(3G), glCopyTexSubImage1D(3G), glCopyTexSubImage2D(3G), glDrawPixels(3G), glHistogram(3G), glMinmax(3G), glPixelStore(3G), glPixelTransfer(3G), glReadPixels(3G), glSeparableFilter2D(3G), glTexImage1D(3G), glTexImage2D(3G), glTexImage3D(3G), glTexSubImage1D(3G), glTexSubImage2D(3G), glTexSubImage3D(3G)
and that's the whole page bestie, you ate it π this was the GLPIXELMAP(3G) manual page β go set up those maps, stay iconic, and remember: power of two or it's giving undefined behavior. mwah πβ¨
π¦ 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