GLPIXELMAP(3G)

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

🌸 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, or GL_PIXEL_MAP_A_TO_A.
  • mapsize β€” how big the map you're defining is, literally the size bestie.
  • values β€” an array of mapsize values. 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 size 1; initial value 0
  • GL_PIXEL_MAP_S_TO_S β€” lookup index: stencil index; lookup value: stencil index; initial size 1; initial value 0
  • GL_PIXEL_MAP_I_TO_R β€” lookup index: color index; lookup value: R; initial size 1; initial value 0
  • GL_PIXEL_MAP_I_TO_G β€” lookup index: color index; lookup value: G; initial size 1; initial value 0
  • GL_PIXEL_MAP_I_TO_B β€” lookup index: color index; lookup value: B; initial size 1; initial value 0
  • GL_PIXEL_MAP_I_TO_A β€” lookup index: color index; lookup value: A; initial size 1; initial value 0
  • GL_PIXEL_MAP_R_TO_R β€” lookup index: R; lookup value: R; initial size 1; initial value 0
  • GL_PIXEL_MAP_G_TO_G β€” lookup index: G; lookup value: G; initial size 1; initial value 0
  • GL_PIXEL_MAP_B_TO_B β€” lookup index: B; lookup value: B; initial size 1; initial value 0
  • GL_PIXEL_MAP_A_TO_A β€” lookup index: A; lookup value: A; initial size 1; initial value 0
⚠️ bestie listen. maps that are indexed by either color or stencil indices MUST have mapsize = 2n for some n, 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_ENUM is generated if map is not an accepted value. (rude, but okay)
  • GL_INVALID_VALUE is generated if mapsize is less than one or larger than GL_MAX_PIXEL_MAP_TABLE.
  • GL_INVALID_VALUE is generated if map is 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, or GL_PIXEL_MAP_I_TO_A, and mapsize is not a power of two. 🫠
  • GL_INVALID_OPERATION is generated if glPixelMap is executed between the execution of glBegin and the corresponding execution of glEnd. just don't do it babe.

πŸ”₯ ASSOCIATED GETS πŸ”₯

  • glGetPixelMap
  • glGet with argument GL_PIXEL_MAP_I_TO_I_SIZE
  • glGet with argument GL_PIXEL_MAP_S_TO_S_SIZE
  • glGet with argument GL_PIXEL_MAP_I_TO_R_SIZE
  • glGet with argument GL_PIXEL_MAP_I_TO_G_SIZE
  • glGet with argument GL_PIXEL_MAP_I_TO_B_SIZE
  • glGet with argument GL_PIXEL_MAP_I_TO_A_SIZE
  • glGet with argument GL_PIXEL_MAP_R_TO_R_SIZE
  • glGet with argument GL_PIXEL_MAP_G_TO_G_SIZE
  • glGet with argument GL_PIXEL_MAP_B_TO_B_SIZE
  • glGet with argument GL_PIXEL_MAP_A_TO_A_SIZE
  • glGet with argument GL_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