void glPixelTransferf(GLenum pname, GLfloat param) void glPixelTransferi(GLenum pname, GLint param)
pname | Specifies the symbolic name of the pixel transfer parameter to be set. In addition to the core GL symbolic names, the following names are also valid: GL_MAP_COLOR, GL_MAP_STENCIL, GL_INDEX_SHIFT, GL_INDEX_OFFSET, GL_RED_SCALE, GL_RED_BIAS, GL_GREEN_SCALE, GL_GREEN_BIAS, GL_BLUE_SCALE, GL_BLUE_BIAS, GL_ALPHA_SCALE, GL_ALPHA_BIAS, GL_DEPTH_SCALE, GL_DEPTH_BIAS, GL_POST_CONVOLUTION_RED_SCALE_EXT, GL_POST_CONVOLUTION_GREEN_SCALE_EXT, GL_POST_CONVOLUTION_BLUE_SCALE_EXT, GL_POST_CONVOLUTION_ALPHA_SCALE_EXT, GL_POST_CONVOLUTION_RED_BIAS_EXT, GL_POST_CONVOLUTION_GREEN_BIAS_EXT, GL_POST_CONVOLUTION_BLUE_BIAS_EXT, GL_POST_CONVOLUTION_ALPHA_BIAS_EXT, GL_POST_COLOR_MATRIX_RED_SCALE_EXT, GL_POST_COLOR_MATRIX_GREEN_SCALE_EXT, GL_POST_COLOR_MATRIX_BLUE_SCALE_EXT, GL_POST_COLOR_MATRIX_ALPHA_SCALE_EXT, GL_POST_COLOR_MATRIX_RED_BIAS_EXT, GL_POST_COLOR_MATRIX_GREEN_BIAS_EXT, GL_POST_COLOR_MATRIX_BLUE_BIAS_EXT, GL_POST_COLOR_MATRIX_ALPHA_BIAS_EXT, GL_RED_MIN_CLAMP_I3D, GL_GREEN_MIN_CLAMP_I3D, GL_BLUE_MIN_CLAMP_I3D, GL_ALPHA_MIN_CLAMP_I3D, GL_RED_MAX_CLAMP_I3D, GL_GREEN_MAX_CLAMP_I3D, GL_BLUE_MAX_CLAMP_I3D, GL_ALPHA_MAX_CLAMP_I3D. |
param | Specifies the value that pname is set to. |
Pixel transfer operations handle four fundamental pixel types: color, color index, depth, and stencil. Color pixels are made up of four floating-point values with unspecified mantissa and exponent sizes, scaled such that 0.0 represents zero intensity and 1.0 represents full intensity. Color indexes 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:
If GL_MAP_COLOR is true, each color component is scaled by the size of the corresponding color-to-color map, and then replaced by the contents of that map indexed by the scaled component. That is, the red component is scaled by GL_PIXEL_MAP_R_TO_R_SIZE, and then replaced by the contents of GL_PIXEL_MAP_R_TO_R indexed by itself. The green component is scaled by GL_PIXEL_MAP_G_TO_G_SIZE, and then replaced by the contents of GL_PIXEL_MAP_G_TO_G indexed by itself. The blue component is scaled by GL_PIXEL_MAP_B_TO_B_SIZE, and then replaced by the contents of GL_PIXEL_MAP_B_TO_B indexed by itself. The alpha component is scaled by GL_PIXEL_MAP_A_TO_A_SIZE, and then replaced by the contents of GL_PIXEL_MAP_A_TO_A indexed by itself. GL_MAP_COLOR is specified with glPixelTransfer. The contents of the various maps are specified with glPixelMap.
If GL_COLOR_TABLE_EXT is true and a non-zero width color table is defined, then
each RGBA color component may be replaced depending on the internal
format of the color table. The components to be replaced are converted
to indices by clamping to
If GL_CONVOLUTION_1D_EXT is true, the one-dimensional convolution filter is applied only to the one-dimensional texture images. If GL_CONVOLUTION_2D_EXT is true, the two-dimensional convolution filter is applied only to the two-dimensional images If GL_SEPARABLE_2D_EXT is true and GL_CONVOLUTION_2D_EXT is false, the separable two-dimensional convolution filter is instead applied to these images. After convolution, each component of the resulting image is scaled by the corresponding PixelTransfer parameters: GL_POST_CONVOLUTION_RED_SCALE_EXT for a red component, GL_POST_CONVOLUTION_GREEN_SCALE_EXT for a green component, GL_POST_CONVOLUTION_BLUE_SCALE_EXT for a blue component, and GL_POST_CONVOLUTION_ALPHA_SCALE_EXT for an alpha component. The result is added to the corresponding bias: GL_POST_CONVOLUTION_RED_BIAS_EXT, GL_POST_CONVOLUTION_GREEN_BIAS_EXT, GL_POST_CONVOLUTION_BLUE_BIAS_EXT, or GL_POST_CONVOLUTION_ALPHA_BIAS_EXT.
If GL_POST_CONVOLUTION_COLOR_TABLE_EXT is true and a non-zero width
post convolution color table is defined, then each RGBA color component
may be replaced depending on the internal format of the post convolution
color table. The components to be replaced are converted to indices by
clamping to
The components are then transformed by the current color matrix. Each transformed component is multiplied by the appropriate scale factor: GL_POST_COLOR_MATRIX_RED_SCALE_EXT for a red component, GL_POST_COLOR_MATRIX_GREEN_SCALE_EXT for a green component, GL_POST_COLOR_MATRIX_BLUE_SCALE_EXT for a blue component, and GL_POST_COLOR_MATRIX_ALPHA_SCALE_EXT for a alpha component, and added to the corresponding bias: GL_POST_COLOR_MATRIX_RED_BIAS_EXT, GL_POST_COLOR_MATRIX_GREEN_BIAS_EXT, GL_POST_COLOR_MATRIX_BLUE_BIAS_EXT, or GL_POST_COLOR_MATRIX_ALPHA_BIAS_EXT. The resulting components replace each component of the original group.
If GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT is true and a non-zero width
post color matrix color table is defined, then each RGBA color component
may be replaced depending on the internal format of the post color matrix
color table. The components to be replaced are converted to indices by
clamping to
Each color component is clamped to the range specified by the corresponding minimum
and maximum clamp values. The red component is clamped to the range specified by
From this point, operation diverges depending on the required format of the
resulting pixels. If the resulting pixels are to be written to a color index
buffer, or if they are being read back to client memory in GL_COLOR_INDEX
format, the pixels continue to be treated as indexes. If GL_MAP_COLOR is true,
then each index is masked by
If the resulting pixels are to be written to an RGBA color buffer, or if they
are being read back to client memory in a format other than GL_COLOR_INDEX, the
pixels are converted from indexes to colors by referencing the four maps
GL_PIXEL_MAP_I_TO_R, GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B, and
GL_PIXEL_MAP_I_TO_A. Before being dereferenced, the index is masked by
pname | Type | Initial Value | Valid Range |
---|---|---|---|
GL_MAP_COLOR | Boolean | GL_FALSE | GL_TRUE/GL_FALSE |
GL_MAP_STENCIL | Boolean | GL_FALSE | GL_TRUE/GL_FALSE |
GL_INDEX_SHIFT | integer | 0 | [-∞,∞] |
GL_INDEX_OFFSET | integer | 0 | [-∞,∞] |
GL_RED_SCALE | float | 1 | [-∞,∞] |
GL_GREEN_SCALE | float | 1 | [-∞,∞] |
GL_BLUE_SCALE | float | 1 | [-∞,∞] |
GL_ALPHA_SCALE | float | 1 | [-∞,∞] |
GL_DEPTH_SCALE | float | 1 | [-∞,∞] |
GL_RED_BIAS | float | 0 | [-∞,∞] |
GL_GREEN_BIAS | float | 0 | [-∞,∞] |
GL_BLUE_BIAS | float | 0 | [-∞,∞] |
GL_ALPHA_BIAS | float | 0 | [-∞,∞] |
GL_DEPTH_BIAS | float | 0 | [-∞,∞] |
GL_POST_CONVOLUTION_RED_SCALE_EXT | float | 1 | [-∞,∞] |
GL_POST_CONVOLUTION_GREEN_SCALE_EXT | float | 1 | [-∞,∞] |
GL_POST_CONVOLUTION_BLUE_SCALE_EXT | float | 1 | [-∞,∞] |
GL_POST_CONVOLUTION_ALPHA_SCALE_EXT | float | 1 | [-∞,∞] |
GL_POST_CONVOLUTION_RED_BIAS_EXT | float | 0 | [-∞,∞] |
GL_POST_CONVOLUTION_GREEN_BIAS_EXT | float | 0 | [-∞,∞] |
GL_POST_CONVOLUTION_BLUE_BIAS_EXT | float | 0 | [-∞,∞] |
GL_POST_CONVOLUTION_ALPHA_BIAS_EXT | float | 0 | [-∞,∞] |
GL_POST_COLOR_MATRIX_RED_SCALE_EXT | float | 1 | [-∞,∞] |
GL_POST_COLOR_MATRIX_GREEN_SCALE_EXT | float | 1 | [-∞,∞] |
GL_POST_COLOR_MATRIX_BLUE_SCALE_EXT | float | 1 | [-∞,∞] |
GL_POST_COLOR_MATRIX_ALPHA_SCALE_EXT | float | 1 | [-∞,∞] |
GL_POST_COLOR_MATRIX_RED_BIAS_EXT | float | 0 | [-∞,∞] |
GL_POST_COLOR_MATRIX_GREEN_BIAS_EXT | float | 0 | [-∞,∞] |
GL_POST_COLOR_MATRIX_BLUE_BIAS_EXT | float | 0 | [-∞,∞] |
GL_POST_COLOR_MATRIX_ALPHA_BIAS_EXT | float | 0 | [-∞,∞] |
GL_RED_MIN_CLAMP_I3D | float | 0 | [0,1] |
GL_GREEN_MIN_CLAMP_I3D | float | 0 | [0,1] |
GL_BLUE_MIN_CLAMP_I3D | float | 0 | [0,1] |
GL_ALPHA_MIN_CLAMP_I3D | float | 0 | [0,1] |
GL_RED_MAX_CLAMP_I3D | float | 0 | [0,1] |
GL_GREEN_MAX_CLAMP_I3D | float | 0 | [0,1] |
GL_BLUE_MAX_CLAMP_I3D | float | 0 | [0,1] |
GL_ALPHA_MAX_CLAMP_I3D | float | 0 | [0,1] |
The glPixelTransferf function can be used to set any pixel transfer parameter. If the parameter type is Boolean, 0.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 also be used to set any of the pixel transfer parameters. Boolean parameters are set to false if param is 0 and true otherwise. The param parameter is converted to floating point before being assigned to real-valued parameters.
GL_INVALID_OPERATION is generated if glPixelTransfer is called between a call to glBegin and the corresponding call to glEnd.