2.0 3.0 > comp > gb.opengl > gl > pixeltransferi
Previous  Next  Edit  Rename  Undo  Search  Administration
 Documentation
Gl.PixelTransferi (gb.opengl)
`Static Sub PixelTransferi ( Pname As Integer, Param As Integer )`

Set pixel transfer modes.

### Parameters

pname

Specifies the symbolic name of the pixel transfer parameter to be set. Must be one of the following: 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, or Gl.DEPTH_BIAS.

Additionally, if the ARB_imaging extension is supported, the following symbolic names are accepted: Gl.POST_COLOR_MATRIX_RED_SCALE, Gl.POST_COLOR_MATRIX_GREEN_SCALE, Gl.POST_COLOR_MATRIX_BLUE_SCALE, Gl.POST_COLOR_MATRIX_ALPHA_SCALE, Gl.POST_COLOR_MATRIX_RED_BIAS, Gl.POST_COLOR_MATRIX_GREEN_BIAS, Gl.POST_COLOR_MATRIX_BLUE_BIAS, Gl.POST_COLOR_MATRIX_ALPHA_BIAS, Gl.POST_CONVOLUTION_RED_SCALE, Gl.POST_CONVOLUTION_GREEN_SCALE, Gl.POST_CONVOLUTION_BLUE_SCALE, Gl.POST_CONVOLUTION_ALPHA_SCALE, Gl.POST_CONVOLUTION_RED_BIAS, Gl.POST_CONVOLUTION_GREEN_BIAS, Gl.POST_CONVOLUTION_BLUE_BIAS, and Gl.POST_CONVOLUTION_ALPHA_BIAS.

param

Specifies the value that pname is set to.

### Description

Gl.PixelTransfer sets pixel transfer modes that affect the operation of subsequent Gl.CopyPixels, Gl.CopyTexImage1D, Gl.CopyTexImage2D, Gl.CopyTexSubImage1D, Gl.CopyTexSubImage2D, Gl.CopyTexSubImage3D, Gl.DrawPixels, Gl.ReadPixels, Gl.TexImage1D, Gl.TexImage2D, Gl.TexImage3D, Gl.TexSubImage1D, Gl.TexSubImage2D, and Gl.TexSubImage3D commands. Additionally, if the ARB_imaging subset is supported, the routines Gl.ColorTable, Gl.ColorSubTable, Gl.ConvolutionFilter1D, Gl.ConvolutionFilter2D, Gl.Histogram, Gl.Minmax, and Gl.SeparableFilter2D are also affected. The algorithms that are specified by pixel transfer modes operate on pixels after they are read from the frame buffer (Gl.CopyPixels Gl.CopyTexImage1D, Gl.CopyTexImage2D, Gl.CopyTexSubImage1D, Gl.CopyTexSubImage2D, Gl.CopyTexSubImage3D, and Gl.ReadPixels), or unpacked from client memory (Gl.DrawPixels, Gl.TexImage1D, Gl.TexImage2D, Gl.TexImage3D, Gl.TexSubImage1D, Gl.TexSubImage2D, and Gl.TexSubImage3D). 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 Gl.PixelStore) 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:

Color

Each of the four color components is multiplied by a scale factor, then added to a bias factor. That is, the red component is multiplied by Gl.RED_SCALE, then added to Gl.RED_BIAS; the green component is multiplied by Gl.GREEN_SCALE, then added to Gl.GREEN_BIAS; the blue component is multiplied by Gl.BLUE_SCALE, then added to Gl.BLUE_BIAS; and the alpha component is multiplied by Gl.ALPHA_SCALE, then added to Gl.ALPHA_BIAS. After all four color components are scaled and biased, each is clamped to the range $\left[0,1\right]$. All color, scale, and bias values are specified with Gl.PixelTransfer.

If Gl.MAP_COLOR is true, each color component is scaled by the size of the corresponding color-to-color map, 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, 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, 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, then replaced by the contents of Gl.PIXEL_MAP_B_TO_B indexed by itself. And the alpha component is scaled by Gl.PIXEL_MAP_A_TO_A_SIZE, then replaced by the contents of Gl.PIXEL_MAP_A_TO_A indexed by itself. All components taken from the maps are then clamped to the range $\left[0,1\right]$. Gl.MAP_COLOR is specified with Gl.PixelTransfer. The contents of the various maps are specified with Gl.PixelMap.

If the ARB_imaging extension is supported, each of the four color components may be scaled and biased after transformation by the color matrix. That is, the red component is multiplied by Gl.POST_COLOR_MATRIX_RED_SCALE, then added to Gl.POST_COLOR_MATRIX_RED_BIAS; the green component is multiplied by Gl.POST_COLOR_MATRIX_GREEN_SCALE, then added to Gl.POST_COLOR_MATRIX_GREEN_BIAS; the blue component is multiplied by Gl.POST_COLOR_MATRIX_BLUE_SCALE, then added to Gl.POST_COLOR_MATRIX_BLUE_BIAS; and the alpha component is multiplied by Gl.POST_COLOR_MATRIX_ALPHA_SCALE, then added to Gl.POST_COLOR_MATRIX_ALPHA_BIAS. After all four color components are scaled and biased, each is clamped to the range $\left[0,1\right]$.

Similarly, if the ARB_imaging extension is supported, each of the four color components may be scaled and biased after processing by the enabled convolution filter. That is, the red component is multiplied by Gl.POST_CONVOLUTION_RED_SCALE, then added to Gl.POST_CONVOLUTION_RED_BIAS; the green component is multiplied by Gl.POST_CONVOLUTION_GREEN_SCALE, then added to Gl.POST_CONVOLUTION_GREEN_BIAS; the blue component is multiplied by Gl.POST_CONVOLUTION_BLUE_SCALE, then added to Gl.POST_CONVOLUTION_BLUE_BIAS; and the alpha component is multiplied by Gl.POST_CONVOLUTION_ALPHA_SCALE, then added to Gl.POST_CONVOLUTION_ALPHA_BIAS. After all four color components are scaled and biased, each is clamped to the range $\left[0,1\right]$.

Color index

Each color index is shifted left by Gl.INDEX_SHIFT bits; any bits beyond the number of fraction bits carried by the fixed-point index are filled with zeros. If Gl.INDEX_SHIFT is negative, the shift is to the right, again zero filled. Then Gl.INDEX_OFFSET is added to the index. Gl.INDEX_SHIFT and Gl.INDEX_OFFSET are specified with Gl.PixelTransfer.

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 indices. If Gl.MAP_COLOR is true, each index is masked by ${2}^{\mathit{n}}-1$, where $\mathit{n}$ is Gl.PIXEL_MAP_I_TO_I_SIZE, then replaced by the contents of Gl.PIXEL_MAP_I_TO_I indexed by the masked value. Gl.MAP_COLOR is specified with Gl.PixelTransfer. The contents of the index map is specified with Gl.PixelMap.

If the resulting pixels are to be written to an RGBA color buffer, or if they are read back to client memory in a format other than Gl.COLOR_INDEX, the pixels are converted from indices 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 ${2}^{\mathit{n}}-1$, where $\mathit{n}$ is Gl.PIXEL_MAP_I_TO_R_SIZE for the red map, Gl.PIXEL_MAP_I_TO_G_SIZE for the green map, Gl.PIXEL_MAP_I_TO_B_SIZE for the blue map, and Gl.PIXEL_MAP_I_TO_A_SIZE for the alpha map. All components taken from the maps are then clamped to the range $\left[0,1\right]$. The contents of the four maps is specified with Gl.PixelMap.

Depth

Each depth value is multiplied by Gl.DEPTH_SCALE, added to Gl.DEPTH_BIAS, then clamped to the range $\left[0,1\right]$.

Stencil

Each index is shifted Gl.INDEX_SHIFT bits just as a color index is, then added to Gl.INDEX_OFFSET. If Gl.MAP_STENCIL is true, each index is masked by ${2}^{\mathit{n}}-1$, where $\mathit{n}$ is Gl.PIXEL_MAP_S_TO_S_SIZE, then replaced by the contents of Gl.PIXEL_MAP_S_TO_S indexed by the masked value.

The following table gives the type, initial value, and range of valid values for each of the pixel transfer parameters that are set with Gl.PixelTransfer.

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 $\left(-\infty ,\infty \right)$
Gl.INDEX_OFFSET integer 0 $\left(-\infty ,\infty \right)$
Gl.RED_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.GREEN_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.BLUE_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.ALPHA_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.DEPTH_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.RED_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.GREEN_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.BLUE_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.ALPHA_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.DEPTH_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.POST_COLOR_MATRIX_RED_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.POST_COLOR_MATRIX_GREEN_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.POST_COLOR_MATRIX_BLUE_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.POST_COLOR_MATRIX_ALPHA_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.POST_COLOR_MATRIX_RED_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.POST_COLOR_MATRIX_GREEN_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.POST_COLOR_MATRIX_BLUE_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.POST_COLOR_MATRIX_ALPHA_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.POST_CONVOLUTION_RED_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.POST_CONVOLUTION_GREEN_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.POST_CONVOLUTION_BLUE_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.POST_CONVOLUTION_ALPHA_SCALE float 1 $\left(-\infty ,\infty \right)$
Gl.POST_CONVOLUTION_RED_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.POST_CONVOLUTION_GREEN_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.POST_CONVOLUTION_BLUE_BIAS float 0 $\left(-\infty ,\infty \right)$
Gl.POST_CONVOLUTION_ALPHA_BIAS float 0 $\left(-\infty ,\infty \right)$

Gl.PixelTransferf 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, Gl.PixelTransferi 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.

### Notes

If a Gl.ColorTable, Gl.ColorSubTable, Gl.ConvolutionFilter1D, Gl.ConvolutionFilter2D, Gl.CopyPixels, Gl.CopyTexImage1D, Gl.CopyTexImage2D, Gl.CopyTexSubImage1D, Gl.CopyTexSubImage2D, Gl.CopyTexSubImage3D, Gl.DrawPixels, Gl.ReadPixels, Gl.SeparableFilter2D, Gl.TexImage1D, Gl.TexImage2D, Gl.TexImage3D, Gl.TexSubImage1D, Gl.TexSubImage2D, or Gl.TexSubImage3D command is placed in a display list (see Gl.NewList and Gl.CallList), 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.

### Errors

Gl.INVALID_ENUM is generated if pname is not an accepted value.

Gl.INVALID_OPERATION is generated if Gl.PixelTransfer is executed between the execution of Gl.Begin and the corresponding execution of Gl.End.

### Associated Gets

Gl.Get with argument Gl.MAP_COLOR

Gl.Get with argument Gl.MAP_STENCIL

Gl.Get with argument Gl.INDEX_SHIFT

Gl.Get with argument Gl.INDEX_OFFSET

Gl.Get with argument Gl.RED_SCALE

Gl.Get with argument Gl.RED_BIAS

Gl.Get with argument Gl.GREEN_SCALE

Gl.Get with argument Gl.GREEN_BIAS

Gl.Get with argument Gl.BLUE_SCALE

Gl.Get with argument Gl.BLUE_BIAS

Gl.Get with argument Gl.ALPHA_SCALE

Gl.Get with argument Gl.ALPHA_BIAS

Gl.Get with argument Gl.DEPTH_SCALE

Gl.Get with argument Gl.DEPTH_BIAS

Gl.Get with argument Gl.POST_COLOR_MATRIX_RED_SCALE

Gl.Get with argument Gl.POST_COLOR_MATRIX_RED_BIAS

Gl.Get with argument Gl.POST_COLOR_MATRIX_GREEN_SCALE

Gl.Get with argument Gl.POST_COLOR_MATRIX_GREEN_BIAS

Gl.Get with argument Gl.POST_COLOR_MATRIX_BLUE_SCALE

Gl.Get with argument Gl.POST_COLOR_MATRIX_BLUE_BIAS

Gl.Get with argument Gl.POST_COLOR_MATRIX_ALPHA_SCALE

Gl.Get with argument Gl.POST_COLOR_MATRIX_ALPHA_BIAS

Gl.Get with argument Gl.POST_CONVOLUTION_RED_SCALE

Gl.Get with argument Gl.POST_CONVOLUTION_RED_BIAS

Gl.Get with argument Gl.POST_CONVOLUTION_GREEN_SCALE

Gl.Get with argument Gl.POST_CONVOLUTION_GREEN_BIAS

Gl.Get with argument Gl.POST_CONVOLUTION_BLUE_SCALE

Gl.Get with argument Gl.POST_CONVOLUTION_BLUE_BIAS

Gl.Get with argument Gl.POST_CONVOLUTION_ALPHA_SCALE

Gl.Get with argument Gl.POST_CONVOLUTION_ALPHA_BIAS