GLPIXELTRANSFER(3G) GLPIXELTRANSFER(3G)
NAME
glPixelTransferf,, glPixelTransferi - set pixel transfer modes
C SPECIFICATION
void glPixelTransferf( GLenum pname,
GLfloat param )
void glPixelTransferi( GLenum pname,
GLint param )
PARAMETERS
pname Specifies the symbolic name of the pixel transfer parameter to
be set. Must be one of the following: GLMAPCOLOR,
GLMAPSTENCIL, GLINDEXSHIFT, GLINDEXOFSET, GLREDSCALE,
GLREDBIAS, GLGRENSCALE, GLGRENBIAS, GLBLUESCALE,
GLBLUEBIAS, GLALPHASCALE, GLALPHABIAS, GLDEPTHSCALE, or
GLDEPTHBIAS.
Additionally, if the GLARBimaging extension is supported, the
following symbolic names are accepted:
GLPOSTCOLORMATRIXREDSCALE,
GLPOSTCOLORMATRIXGRENSCALE,
GLPOSTCOLORMATRIXBLUESCALE,
GLPOSTCOLORMATRIXALPHASCALE, GLPOSTCOLORMATRIXREDBIAS,
GLPOSTCOLORMATRIXGRENBIAS, GLPOSTCOLORMATRIXBLUEBIAS,
GLPOSTCOLORMATRIXALPHABIAS, GLPOSTCONVOLUTIONREDSCALE,
GLPOSTCONVOLUTIONGRENSCALE, GLPOSTCONVOLUTIONBLUESCALE,
GLPOSTCONVOLUTIONALPHASCALE, GLPOSTCONVOLUTIONREDBIAS,
GLPOSTCONVOLUTIONGRENBIAS, GLPOSTCONVOLUTIONBLUEBIAS,
and GLPOSTCONVOLUTIONALPHABIAS.
param Specifies the value that pname is set to.
DESCRIPTION
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. Addi-
tionally, if the GLARBimaging subset is supported, the routines
glColorTable, glColorSubTable, glConvolutionFilter1D,
glConvolutionFilter2D, glHistogram, glinmax, 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 float-
ing-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 com-
ponent is multiplied by GLREDSCALE, then added to
GLREDBIAS; the green component is multiplied by
GLGRENSCALE, then added to GLGRENBIAS; the blue com-
ponent is multiplied by GLBLUESCALE, then added to
GLBLUEBIAS; and the alpha component is multiplied by
GLALPHASCALE, then added to GLALPHABIAS. After all
four color components are scaled and biased, each is
clamped to the range [0,1]. All color, scale, and bias
values are specified with glPixelTransfer.
If GLMAPCOLOR 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
GLPIXELMAPRTORSIZE, then replaced by the contents of
GLPIXELMAPRTOR indexed by itself. The green component
is scaled by GLPIXELMAPGTOGSIZE, then replaced by the
contents of GLPIXELMAPGTOG indexed by itself. The
blue component is scaled by GLPIXELMAPBTOBSIZE, then
replaced by the contents of GLPIXELMAPBTOB indexed by
itself. And the alpha component is scaled by
GLPIXELMAPATOASIZE, then replaced by the contents of
GLPIXELMAPATOA indexed by itself. All components
taken from the maps are then clamped to the range [0,1].
GLMAPCOLOR is specified with glPixelTransfer. The con-
tents of the various maps are specified with glPixelap.
If the GLARBimaging extension is supported, each of the
four color components may be scaled and biased after tran-
formation by the color matrix. That is, the red component
is multiplied by GLPOSTCOLORMATRIXREDSCALE, then added
to GLPOSTCOLORMATRIXREDBIAS; the green component is
multiplied by GLPOSTCOLORMATRIXGRENSCALE, then added
to GLPOSTCOLORMATRIXGRENBIAS; the blue component is
multiplied by GLPOSTCOLORMATRIXBLUESCALE, then added
to GLPOSTCOLORMATRIXBLUEBIAS; and the alpha component
is multiplied by GLPOSTCOLORMATRIXALPHASCALE, then
added to GLPOSTCOLORMATRIXALPHABIAS. After all four
color components are scaled and biased, each is clamped to
the range [0,1].
Similiarly, if the GLARBimaging 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
GLPOSTCONVOLUTIONREDSCALE, then added to
GLPOSTCONVOLUTIONREDBIAS; the green component is multi-
plied by GLPOSTCONVOLUTIONGRENSCALE, then added to
GLPOSTCONVOLUTIONGRENBIAS; the blue component is mul-
tiplied by GLPOSTCONVOLUTIONBLUESCALE, then added to
GLPOSTCONVOLUTIONBLUEBIAS; and the alpha component is
multiplied by GLPOSTCONVOLUTIONALPHASCALE, then added
to GLPOSTCONVOLUTIONALPHABIAS. After all four color
components are scaled and biased, each is clamped to the
range [0,1].
Color index Each color index is shifted left by GLINDEXSHIFT bits;
any bits beyond the number of fraction bits carried by the
fixed-point index are filled with zeros. If GLINDEXSHIFT
is negative, the shift is to the right, again zero filled.
Then GLINDEXOFSET is added to the index. GLINDEXSHIFT
and GLINDEXOFSET are specified with
glPixelTransfer.
From this point, operation diverges depending on the
required 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 GLCOLORINDEX , the
pixels continue to be treated as indices. If GLMAPCOLOR
is true, each index is masked by (2^n)-1, where n is
GLPIXELMAPITOISIZE, then replaced by the contents of
GLPIXELMAPITOI indexed by the masked value.
GLMAPCOLOR is specified with glPixelTransfer. The con-
tents of the index map is specified with glPixelap.
If the resulting pixels are to be written to an RGBA color
buffer, or if they are read back to client memory in a
other than GLCOLORINDEX, the pixels are converted from
indices to colors by referencing the four maps
GLPIXELMAPITOR, GLPIXELMAPITOG,
GLPIXELMAPITOB, and GLPIXELMAPITOA. Before being
dereferenced, the index is masked by (2^n)-1, where n is
GLPIXELMAPITORSIZE for the red map,
GLPIXELMAPITOGSIZE for the green map,
GLPIXELMAPITOBSIZE for the blue map, and
GLPIXELMAPITOASIZE for the alpha map. All components
taken from the maps are then clamped to the range [0,1].
The contents of the four maps is specified with glPixelap.
Depth Each depth value is multiplied by GLDEPTHSCALE, added to
GLDEPTHBIAS, then clamped to the range [0,1].
Stencil Each index is shifted GLINDEXSHIFT bits just as a color
index is, then added to GLINDEXOFSET. If GLMAPSTENCIL
is true, each index is masked by (2^n)-1, where n is
GLPIXELMAPSTOSIZE, then replaced by the contents of
GLPIXELMAPSTOS 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
glPixelTransfer.
pname (Type, Initial Value, Valid Range)
GLMAPCOLOR (boolean, false, true/false)
GLMAPSTENCIL (boolean, false, true/false)
GLINDEXSHIFT (integer, 0, -inf/inf)
GLINDEXOFSET (integer, 0, -inf/inf)
GLREDSCALE (float, 1, -inf/inf)
GLGRENSCALE (float, 1, -inf/inf)
GLBLUESCALE (float, 1, -inf/inf)
GLALPHASCALE (float, 1, -inf/inf)
GLDEPTHSCALE (float, 1, -inf/inf)
GLREDBIAS (float, 0, -inf/inf)
GLGRENBIAS (float, 0, -inf/inf)
GLBLUEBIAS (float, 0, -inf/inf)
GLALPHABIAS (float, 0, -inf/inf)
GLDEPTHBIAS (float, 0, -inf/inf)
GLPOSTCOLORMATRIXREDSCALE (float, 1, -inf/inf)
GLPOSTCOLORMATRIXGRENSCALE (float, 1, -inf/inf)
GLPOSTCOLORMATRIXBLUESCALE (float, 1, -inf/inf)
GLPOSTCOLORMATRIXALPHASCALE (float, 1, -inf/inf)
GLPOSTCOLORMATRIXREDBIAS (float, 0, -inf/inf)
GLPOSTCOLORMATRIXGRENBIAS (float, 0, -inf/inf)
GLPOSTCOLORMATRIXBLUEBIAS (float, 0, -inf/inf)
GLPOSTCOLORMATRIXALPHABIAS (float, 0, -inf/inf)
GLPOSTCONVOLUTIONREDSCALE (float, 1, -inf/inf)
GLPOSTCONVOLUTIONGRENSCALE (float, 1, -inf/inf)
GLPOSTCONVOLUTIONBLUESCALE (float, 1, -inf/inf)
GLPOSTCONVOLUTIONALPHASCALE (float, 1, -inf/inf)
GLPOSTCONVOLUTIONREDBIAS (float, 0, -inf/inf)
GLPOSTCONVOLUTIONGRENBIAS (float, 0, -inf/inf)
GLPOSTCONVOLUTIONBLUEBIAS (float, 0, -inf/inf)
GLPOSTCONVOLUTIONALPHABIAS (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.
NOTES
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.
ERORS
GLINVALIDENUM is generated if pname is not an accepted value.
GLINVALIDOPERATION is generated if glPixelTransfer is executed
between the execution of glBegin and the corresponding execution of
glEnd.
ASOCIATED GETS
glGet with argument GLMAPCOLOR
glGet with argument GLMAPSTENCIL
glGet with argument GLINDEXSHIFT
glGet with argument GLINDEXOFSET
glGet with argument GLREDSCALE
glGet with argument GLREDBIAS
glGet with argument GLGRENSCALE
glGet with argument GLGRENBIAS
glGet with argument GLBLUESCALE
glGet with argument GLBLUEBIAS
glGet with argument GLALPHASCALE
glGet with argument GLALPHABIAS
glGet with argument GLDEPTHSCALE
glGet with argument GLDEPTHBIAS
glGet with argument GLPOSTCOLORMATRIXREDSCALE
glGet with argument GLPOSTCOLORMATRIXREDBIAS
glGet with argument GLPOSTCOLORMATRIXGRENSCALE
glGet with argument GLPOSTCOLORMATRIXGRENBIAS
glGet with argument GLPOSTCOLORMATRIXBLUESCALE
glGet with argument GLPOSTCOLORMATRIXBLUEBIAS
glGet with argument GLPOSTCOLORMATRIXALPHASCALE
glGet with argument GLPOSTCOLORMATRIXALPHABIAS
glGet with argument GLPOSTCONVOLUTIONREDSCALE
glGet with argument GLPOSTCONVOLUTIONREDBIAS
glGet with argument GLPOSTCONVOLUTIONGRENSCALE
glGet with argument GLPOSTCONVOLUTIONGRENBIAS
glGet with argument GLPOSTCONVOLUTIONBLUESCALE
glGet with argument GLPOSTCONVOLUTIONBLUEBIAS
glGet with argument GLPOSTCONVOLUTIONALPHASCALE
glGet with argument GLPOSTCONVOLUTIONALPHABIAS
SEE ALSO
glCallList, glColorTable, glColorSubTable, glConvolutionFilter1D,
glConvolutionFilter2D, glCopyPixels, glCopyTexImage1D,
glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D,
glCopyTexSubImage3D, glDrawPixels, glNewList, glPixelap, glPixelStore,
glPixelZoom, glReadPixels, glTexImage1D, glTexImage2D, glTexImage3D,
glTexSubImage1D, glTexSubImage2D, glTexSubImage3D
GLPIXELTRANSFER(3G)
|