GLPIXELTRANSFER(3G) | GLPIXELTRANSFER(3G) |
glPixelTransferf, glPixelTransferi - set pixel transfer modes
void glPixelTransferf( GLenum pname,
GLfloat param )
void glPixelTransferi( GLenum pname,
GLint param )
glPixelTransfer sets pixel transfer modes that affect the operation of subsequent glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glDrawPixels, glReadPixels, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, and glTexSubImage3D commands. Additionally, if the GL_ARB_imaging subset is supported, the routines glColorTable, glColorSubTable, glConvolutionFilter1D, glConvolutionFilter2D, glHistogram, glMinmax, and glSeparableFilter2D are also affected. The algorithms that are specified by pixel transfer modes operate on pixels after they are read from the frame buffer (glCopyPixels glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, and glReadPixels), or unpacked from client memory (glDrawPixels, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, and glTexSubImage3D). Pixel transfer operations happen in the same order, and in the same manner, regardless of the command that resulted in the pixel operation. Pixel storage modes (see glPixelStore) control the unpacking of pixels being read from client memory, and the packing of pixels being written back into client memory.
Pixel transfer operations handle four fundamental pixel types: color, color index, depth, and stencil. Color pixels consist of four floating-point values with unspecified mantissa and exponent sizes, scaled such that 0 represents zero intensity and 1 represents full intensity. Color indices comprise a single fixed-point value, with unspecified precision to the right of the binary point. Depth pixels comprise a single floating-point value, with unspecified mantissa and exponent sizes, scaled such that 0.0 represents the minimum depth buffer value, and 1.0 represents the maximum depth buffer value. Finally, stencil pixels comprise a single fixed-point value, with unspecified precision to the right of the binary point.
The pixel transfer operations performed on the four basic pixel types are as follows:
The following table gives the type, initial value, and range of valid values for each of the pixel transfer parameters that are set with glPixelTransfer.
pname (Type, Initial Value, Valid Range)
GL_MAP_COLOR (boolean, false, true/false)
GL_MAP_STENCIL (boolean, false, true/false)
GL_INDEX_SHIFT (integer, 0, -inf/inf)
GL_INDEX_OFFSET (integer, 0, -inf/inf)
GL_RED_SCALE (float, 1, -inf/inf)
GL_GREEN_SCALE (float, 1, -inf/inf)
GL_BLUE_SCALE (float, 1, -inf/inf)
GL_ALPHA_SCALE (float, 1, -inf/inf)
GL_DEPTH_SCALE (float, 1, -inf/inf)
GL_RED_BIAS (float, 0, -inf/inf)
GL_GREEN_BIAS (float, 0, -inf/inf)
GL_BLUE_BIAS (float, 0, -inf/inf)
GL_ALPHA_BIAS (float, 0, -inf/inf)
GL_DEPTH_BIAS (float, 0, -inf/inf)
GL_POST_COLOR_MATRIX_RED_SCALE (float, 1, -inf/inf)
GL_POST_COLOR_MATRIX_GREEN_SCALE (float, 1, -inf/inf)
GL_POST_COLOR_MATRIX_BLUE_SCALE (float, 1, -inf/inf)
GL_POST_COLOR_MATRIX_ALPHA_SCALE (float, 1, -inf/inf)
GL_POST_COLOR_MATRIX_RED_BIAS (float, 0, -inf/inf)
GL_POST_COLOR_MATRIX_GREEN_BIAS (float, 0, -inf/inf)
GL_POST_COLOR_MATRIX_BLUE_BIAS (float, 0, -inf/inf)
GL_POST_COLOR_MATRIX_ALPHA_BIAS (float, 0, -inf/inf)
GL_POST_CONVOLUTION_RED_SCALE (float, 1, -inf/inf)
GL_POST_CONVOLUTION_GREEN_SCALE (float, 1, -inf/inf)
GL_POST_CONVOLUTION_BLUE_SCALE (float, 1, -inf/inf)
GL_POST_CONVOLUTION_ALPHA_SCALE (float, 1, -inf/inf)
GL_POST_CONVOLUTION_RED_BIAS (float, 0, -inf/inf)
GL_POST_CONVOLUTION_GREEN_BIAS (float, 0, -inf/inf)
GL_POST_CONVOLUTION_BLUE_BIAS (float, 0, -inf/inf)
GL_POST_CONVOLUTION_ALPHA_BIAS (float, 0, -inf/inf)
glPixelTransferf can be used to set any pixel transfer parameter. If the parameter type is boolean, 0 implies false and any other value implies true. If pname is an integer parameter, param is rounded to the nearest integer.
Likewise, glPixelTransferi can be used to set any of the pixel transfer parameters. Boolean parameters are set to false if param is 0 and to true otherwise. param is converted to floating point before being assigned to real-valued parameters.
If a glColorTable, glColorSubTable, glConvolutionFilter1D, glConvolutionFilter2D, glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glDrawPixels, glReadPixels, glSeparableFilter2D, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, or glTexSubImage3D. command is placed in a display list (see glNewList and glCallList), the pixel transfer mode settings in effect when the display list is executed are the ones that are used. They may be different from the settings when the command was compiled into the display list.
GL_INVALID_ENUM is generated if pname is not an accepted value.
GL_INVALID_OPERATION is generated if glPixelTransfer is executed between the execution of glBegin and the corresponding execution of glEnd.
glGet with argument GL_MAP_COLOR
glGet with argument GL_MAP_STENCIL
glGet with argument GL_INDEX_SHIFT
glGet with argument GL_INDEX_OFFSET
glGet with argument GL_RED_SCALE
glGet with argument GL_RED_BIAS
glGet with argument GL_GREEN_SCALE
glGet with argument GL_GREEN_BIAS
glGet with argument GL_BLUE_SCALE
glGet with argument GL_BLUE_BIAS
glGet with argument GL_ALPHA_SCALE
glGet with argument GL_ALPHA_BIAS
glGet with argument GL_DEPTH_SCALE
glGet with argument GL_DEPTH_BIAS
glGet with argument GL_POST_COLOR_MATRIX_RED_SCALE
glGet with argument GL_POST_COLOR_MATRIX_RED_BIAS
glGet with argument GL_POST_COLOR_MATRIX_GREEN_SCALE
glGet with argument GL_POST_COLOR_MATRIX_GREEN_BIAS
glGet with argument GL_POST_COLOR_MATRIX_BLUE_SCALE
glGet with argument GL_POST_COLOR_MATRIX_BLUE_BIAS
glGet with argument GL_POST_COLOR_MATRIX_ALPHA_SCALE
glGet with argument GL_POST_COLOR_MATRIX_ALPHA_BIAS
glGet with argument GL_POST_CONVOLUTION_RED_SCALE
glGet with argument GL_POST_CONVOLUTION_RED_BIAS
glGet with argument GL_POST_CONVOLUTION_GREEN_SCALE
glGet with argument GL_POST_CONVOLUTION_GREEN_BIAS
glGet with argument GL_POST_CONVOLUTION_BLUE_SCALE
glGet with argument GL_POST_CONVOLUTION_BLUE_BIAS
glGet with argument GL_POST_CONVOLUTION_ALPHA_SCALE
glGet with argument GL_POST_CONVOLUTION_ALPHA_BIAS
glCallList, glColorTable, glColorSubTable, glConvolutionFilter1D, glConvolutionFilter2D, glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glCopyTexSubImage3D, glDrawPixels, glNewList, glPixelMap, glPixelStore, glPixelZoom, glReadPixels, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, glTexSubImage3D