glPixelMapfv, glPixelMapuiv, glPixelMapusv

These functions set up pixel transfer maps.

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
A symbolic map name. The ten maps are as follows:
GL_PIXEL_MAP_I_TO_I
Maps color indexes to color indexes.
GL_PIXEL_MAP_S_TO_S
Maps stencil indexes to stencil indexes.
GL_PIXEL_MAP_I_TO_R
Maps color indexes to red components.
GL_PIXEL_MAP_I_TO_G
Maps color indexes to green components.
GL_PIXEL_MAP_I_TO_B
Maps color indexes to blue components.
GL_PIXEL_MAP_I_TO_A
Maps color indexes 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.
mapsize
The size of the map being defined.
values
An array of mapsize values.

Remarks

The glPixelMap function sets up translation tables, or maps, used by glDrawPixels, glReadPixels, glCopyPixels, glTexImage1D, and glTexImage2D. Use of these maps is described completely in the glPixelTransfer topic, and partly in the topics for the pixel and texture image commands. Only the specification of the maps is described in this topic.

The map parameter is a symbolic map name, indicating one of ten maps to set. The mapsize parameter specifies the number of entries in the map, and values is a pointer to an array of mapsize map values.

The entries in a map can be specified as single-precision floating-point numbers, unsigned short integers, or unsigned long integers. Maps that store color component values (all but GL_PIXEL_MAP_I_TO_I and GL_PIXEL_MAP_S_TO_S) retain their values in floating-point format, with unspecified mantissa and exponent sizes. Floating-point values specified by glPixelMapfv are converted directly to the internal floating-point format of these maps, and then clamped to the range [0,1]. Unsigned integer values specified by glPixelMapusv and glPixelMapuiv are converted linearly such that the largest representable integer maps to 1.0, and zero maps to 0.0.

Maps that store indexes, GL_PIXEL_MAP_I_TO_I and GL_PIXEL_MAP_S_TO_S, retain their values in fixed-point format, with an unspecified number of bits to the right of the binary point. Floating-point values specified by glPixelMapfv are converted directly to the internal fixed-point format of these maps. Unsigned integer values specified by glPixelMapusv and glPixelMapuiv specify integer values, with all zeros to the right of the binary point.

The following table shows the initial sizes and values for each of the maps. Maps that are indexed by either color or stencil indexes must have mapsize = 2^n for some n or results are undefined. The maximum allowable size for each map depends on the implementation and can be determined by calling glGet with argument GL_MAX_PIXEL_MAP_TABLE. The single maximum applies to all maps, and it is at least 32.

GL_PIXEL_MAP_I_TO_I

Lookup Index: color index
Lookup Value: color index
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_S_TO_S

Lookup Index: stencil index
Lookup Value: stencil index
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_I_TO_R

Lookup Index: color index
Lookup Value: R
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_I_TO_G

Lookup Index: color index
Lookup Value: G
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_I_TO_B

Lookup Index: color index
Lookup Value: B
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_I_TO_A

Lookup Index: color index
Lookup Value: A
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_R_TO_R

Lookup Index: R
Lookup Value: R
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_G_TO_G

Lookup Index: G
Lookup Value: G
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_B_TO_B

Lookup Index: B
Lookup Value: B
Initial Size: 1
Initial Value: 0.0

GL_PIXEL_MAP_A_TO_A

Lookup Index: A
Lookup Value: A
Initial Size: 1
Initial Value: 0.0

The following functions retrieve information related to glPixelMap:

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

Error Codes

The following are the error codes generated and their conditions.

Error Code Condition
GL_INVALID_ENUM map was not an accepted value.
GL_INVALID_VALUE mapsize was negative or larger than GL_MAX_PIXEL_MAP_TABLE.
GL_INVALID_VALUE map was 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 was not a power of two.
GL_INVALID_OPERATION glPixelMap was called between a call to glBegin and the corresponding call to glEnd.

QuickInfo

  Windows NT: Use version 3.5 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in gl.h.
  Import Library: Link with opengl32.lib.

See Also

glBegin, glCopyPixels, glDrawPixels, glEnd, glPixelStore, glPixelTransfer, glReadPixels, glTexImage1D, glTexImage2D