pixeltransfer.3gl   [plain text]


'\" te
'\"! tbl|eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 pixeltran
.ds Xs 52457 17 pixeltransfer.gl
.TH GLPIXELTRANSFER 3G
.SH NAME
.B "glPixelTransferf, glPixelTransferi
\- set pixel transfer modes

.SH C SPECIFICATION
void \f3glPixelTransferf\fP(
GLenum \fIpname\fP,
.nf
.ta \w'\f3void \fPglPixelTransferf( 'u
	GLfloat \fIparam\fP )
.fi
void \f3glPixelTransferi\fP(
GLenum \fIpname\fP,
.nf
.ta \w'\f3void \fPglPixelTransferi( 'u
	GLint \fIparam\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\f2pname\fP\ \ 'u 
\f2pname\fP
Specifies the symbolic name of the pixel transfer parameter to be set.
Must be one of the following:
\%\f3GL_MAP_COLOR\fP,
\%\f3GL_MAP_STENCIL\fP,
\%\f3GL_INDEX_SHIFT\fP,
\%\f3GL_INDEX_OFFSET\fP,
\%\f3GL_RED_SCALE\fP,
\%\f3GL_RED_BIAS\fP,
\%\f3GL_GREEN_SCALE\fP,
\%\f3GL_GREEN_BIAS\fP,
\%\f3GL_BLUE_SCALE\fP,
\%\f3GL_BLUE_BIAS\fP,
\%\f3GL_ALPHA_SCALE\fP,
\%\f3GL_ALPHA_BIAS\fP,
\%\f3GL_DEPTH_SCALE\fP, or
\%\f3GL_DEPTH_BIAS\fP.
.IP
Additionally, if the \%\f3GL_ARB_imaging\fP extension is supported, the
following symbolic names are accepted:
\%\f3GL_POST_COLOR_MATRIX_RED_SCALE\fP,
\%\f3GL_POST_COLOR_MATRIX_GREEN_SCALE\fP,
\%\f3GL_POST_COLOR_MATRIX_BLUE_SCALE\fP,
\%\f3GL_POST_COLOR_MATRIX_ALPHA_SCALE\fP,
\%\f3GL_POST_COLOR_MATRIX_RED_BIAS\fP,
\%\f3GL_POST_COLOR_MATRIX_GREEN_BIAS\fP,
\%\f3GL_POST_COLOR_MATRIX_BLUE_BIAS\fP,
\%\f3GL_POST_COLOR_MATRIX_ALPHA_BIAS\fP,
\%\f3GL_POST_CONVOLUTION_RED_SCALE\fP,
\%\f3GL_POST_CONVOLUTION_GREEN_SCALE\fP,
\%\f3GL_POST_CONVOLUTION_BLUE_SCALE\fP,
\%\f3GL_POST_CONVOLUTION_ALPHA_SCALE\fP,
\%\f3GL_POST_CONVOLUTION_RED_BIAS\fP,
\%\f3GL_POST_CONVOLUTION_GREEN_BIAS\fP,
\%\f3GL_POST_CONVOLUTION_BLUE_BIAS\fP, and
\%\f3GL_POST_CONVOLUTION_ALPHA_BIAS\fP.
.TP
\f2param\fP
Specifies the value that \f2pname\fP is set to.
.SH DESCRIPTION
\%\f3glPixelTransfer\fP sets pixel transfer modes that affect the operation of subsequent
\%\f3glCopyPixels\fP,
\%\f3glCopyTexImage1D\fP,
\%\f3glCopyTexImage2D\fP,
\%\f3glCopyTexSubImage1D\fP,
\%\f3glCopyTexSubImage2D\fP,
\%\f3glCopyTexSubImage3D\fP,
\%\f3glDrawPixels\fP,
\%\f3glReadPixels\fP,
\%\f3glTexImage1D\fP,
\%\f3glTexImage2D\fP,
\%\f3glTexImage3D\fP,
\%\f3glTexSubImage1D\fP,
\%\f3glTexSubImage2D\fP, and
\%\f3glTexSubImage3D\fP commands.
Additionally, if the \%\f3GL_ARB_imaging\fP subset is supported, the
routines
\%\f3glColorTable\fP,
\%\f3glColorSubTable\fP,
\%\f3glConvolutionFilter1D\fP,
\%\f3glConvolutionFilter2D\fP,
\%\f3glHistogram\fP,
\%\f3glMinmax\fP, and
\%\f3glSeparableFilter2D\fP are also affected.
The algorithms that are specified by pixel transfer modes operate on
pixels after they are read from the frame buffer
(\%\f3glCopyPixels\fP
\%\f3glCopyTexImage1D\fP,
\%\f3glCopyTexImage2D\fP,
\%\f3glCopyTexSubImage1D\fP,
\%\f3glCopyTexSubImage2D\fP,
\%\f3glCopyTexSubImage3D\fP, and
\%\f3glReadPixels\fP),
or unpacked from client memory
(\%\f3glDrawPixels\fP, \%\f3glTexImage1D\fP, \%\f3glTexImage2D\fP, \%\f3glTexImage3D\fP,
\%\f3glTexSubImage1D\fP, \%\f3glTexSubImage2D\fP, and \%\f3glTexSubImage3D\fP). 
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 \%\f3glPixelStore\fP)
control the unpacking of pixels being read from client memory,
and the packing of pixels being written back into client memory.
.P
Pixel transfer operations handle four fundamental pixel types:
\f2color\fP,
\f2color index\fP,
\f2depth\fP, and
\f2stencil\fP.
\f2Color\fP 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.
\f2Color indices\fP comprise a single fixed-point value,
with unspecified precision to the right of the binary point.
\f2Depth\fP 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,
\f2stencil\fP pixels comprise a single fixed-point value,
with unspecified precision to the right of the binary point.
.BP
.P
The pixel transfer operations performed on the four basic pixel types are 
as follows:
.TP 12
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 \%\f3GL_RED_SCALE\fP,
then added to \%\f3GL_RED_BIAS\fP;
the green component is multiplied by \%\f3GL_GREEN_SCALE\fP,
then added to \%\f3GL_GREEN_BIAS\fP;
the blue component is multiplied by \%\f3GL_BLUE_SCALE\fP,
then added to \%\f3GL_BLUE_BIAS\fP; and
the alpha component is multiplied by \%\f3GL_ALPHA_SCALE\fP,
then added to \%\f3GL_ALPHA_BIAS\fP.
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 \%\f3glPixelTransfer\fP.
.IP
If \%\f3GL_MAP_COLOR\fP 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 \%\f3GL_PIXEL_MAP_R_TO_R_SIZE\fP,
then replaced by the contents of \%\f3GL_PIXEL_MAP_R_TO_R\fP indexed by itself.
The green component is scaled by \%\f3GL_PIXEL_MAP_G_TO_G_SIZE\fP,
then replaced by the contents of \%\f3GL_PIXEL_MAP_G_TO_G\fP indexed by itself.
The blue component is scaled by \%\f3GL_PIXEL_MAP_B_TO_B_SIZE\fP,
then replaced by the contents of \%\f3GL_PIXEL_MAP_B_TO_B\fP indexed by itself.
And
the alpha component is scaled by \%\f3GL_PIXEL_MAP_A_TO_A_SIZE\fP,
then replaced by the contents of \%\f3GL_PIXEL_MAP_A_TO_A\fP indexed by itself.
All components taken from the maps are then clamped to the range [0,1].
\%\f3GL_MAP_COLOR\fP is specified with \%\f3glPixelTransfer\fP.
The contents of the various maps are specified with \%\f3glPixelMap\fP.
.IP
If the \%\f3GL_ARB_imaging\fP extension is supported, each of the four
color components may be scaled and biased after tranformation by the
color matrix.  
That is,
the red component is multiplied by \%\f3GL_POST_COLOR_MATRIX_RED_SCALE\fP,
then added to \%\f3GL_POST_COLOR_MATRIX_RED_BIAS\fP;
the green component is multiplied by \%\f3GL_POST_COLOR_MATRIX_GREEN_SCALE\fP,
then added to \%\f3GL_POST_COLOR_MATRIX_GREEN_BIAS\fP;
the blue component is multiplied by \%\f3GL_POST_COLOR_MATRIX_BLUE_SCALE\fP,
then added to \%\f3GL_POST_COLOR_MATRIX_BLUE_BIAS\fP; and
the alpha component is multiplied by \%\f3GL_POST_COLOR_MATRIX_ALPHA_SCALE\fP,
then added to \%\f3GL_POST_COLOR_MATRIX_ALPHA_BIAS\fP.
After all four color components are scaled and biased,
each is clamped to the range [0,1].
.IP
Similiarly, if the \%\f3GL_ARB_imaging\fP 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 \%\f3GL_POST_CONVOLUTION_RED_SCALE\fP,
then added to \%\f3GL_POST_CONVOLUTION_RED_BIAS\fP;
the green component is multiplied by \%\f3GL_POST_CONVOLUTION_GREEN_SCALE\fP,
then added to \%\f3GL_POST_CONVOLUTION_GREEN_BIAS\fP;
the blue component is multiplied by \%\f3GL_POST_CONVOLUTION_BLUE_SCALE\fP,
then added to \%\f3GL_POST_CONVOLUTION_BLUE_BIAS\fP; and
the alpha component is multiplied by \%\f3GL_POST_CONVOLUTION_ALPHA_SCALE\fP,
then added to \%\f3GL_POST_CONVOLUTION_ALPHA_BIAS\fP.
After all four color components are scaled and biased,
each is clamped to the range [0,1].
.TP
Color index
Each color index is shifted left by \%\f3GL_INDEX_SHIFT\fP bits; any bits
beyond the number of fraction bits carried
by the fixed-point index are filled with zeros.
If \%\f3GL_INDEX_SHIFT\fP is negative,
the shift is to the right,
again zero filled.
Then \%\f3GL_INDEX_OFFSET\fP is added to the index.
\%\f3GL_INDEX_SHIFT\fP and \%\f3GL_INDEX_OFFSET\fP are specified with 
.br
\%\f3glPixelTransfer\fP.
.IP
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 \%\f3GL_COLOR_INDEX\fP ,
the pixels continue to be treated as indices.
If \%\f3GL_MAP_COLOR\fP is true,
each index is masked by $2 sup n ~-~ 1$,
where $n$ is \%\f3GL_PIXEL_MAP_I_TO_I_SIZE\fP,
then replaced by the contents of \%\f3GL_PIXEL_MAP_I_TO_I\fP indexed by the
masked value.
\%\f3GL_MAP_COLOR\fP is specified with \%\f3glPixelTransfer\fP.
The contents of the index map is specified with \%\f3glPixelMap\fP.
.IP
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
\%\f3GL_COLOR_INDEX\fP,
the pixels are converted from indices to colors by referencing the
four maps
\%\f3GL_PIXEL_MAP_I_TO_R\fP,
\%\f3GL_PIXEL_MAP_I_TO_G\fP,
\%\f3GL_PIXEL_MAP_I_TO_B\fP, and
\%\f3GL_PIXEL_MAP_I_TO_A\fP.
Before being dereferenced,
the index is masked by $2 sup n ~-~ 1$,
where $n$ is
\%\f3GL_PIXEL_MAP_I_TO_R_SIZE\fP for the red map,
\%\f3GL_PIXEL_MAP_I_TO_G_SIZE\fP for the green map,
\%\f3GL_PIXEL_MAP_I_TO_B_SIZE\fP for the blue map, and
\%\f3GL_PIXEL_MAP_I_TO_A_SIZE\fP 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 \%\f3glPixelMap\fP.
.TP
Depth
Each depth value is multiplied by \%\f3GL_DEPTH_SCALE\fP,
added to \%\f3GL_DEPTH_BIAS\fP,
then clamped to the range [0,1].
.TP
Stencil
Each index is shifted \%\f3GL_INDEX_SHIFT\fP bits just as a color index is,
then added to \%\f3GL_INDEX_OFFSET\fP.
If \%\f3GL_MAP_STENCIL\fP is true,
each index is masked by $2 sup n ~-~ 1$,
where $n$ is \%\f3GL_PIXEL_MAP_S_TO_S_SIZE\fP,
then replaced by the contents of \%\f3GL_PIXEL_MAP_S_TO_S\fP indexed by the
masked value.
.P
The following table gives the type,
initial value,
and range of valid values for each of the pixel transfer parameters
that are set with \%\f3glPixelTransfer\fP.
.sp

.TS
center tab(:);
lb cb cb cb
l c c c.
_
\f2pname\fP:Type:Initial Value:Valid Range
_
\%\f3GL_MAP_COLOR\fP:boolean:false:true/false
\%\f3GL_MAP_STENCIL\fP:boolean:false:true/false
\%\f3GL_INDEX_SHIFT\fP:integer:0:(-\(if,\(if)
\%\f3GL_INDEX_OFFSET\fP:integer:0:(-\(if,\(if)
\%\f3GL_RED_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_GREEN_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_BLUE_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_ALPHA_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_DEPTH_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_RED_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_GREEN_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_BLUE_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_ALPHA_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_DEPTH_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_POST_COLOR_MATRIX_RED_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_POST_COLOR_MATRIX_GREEN_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_POST_COLOR_MATRIX_BLUE_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_POST_COLOR_MATRIX_ALPHA_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_POST_COLOR_MATRIX_RED_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_POST_COLOR_MATRIX_GREEN_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_POST_COLOR_MATRIX_BLUE_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_POST_COLOR_MATRIX_ALPHA_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_POST_CONVOLUTION_RED_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_POST_CONVOLUTION_GREEN_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_POST_CONVOLUTION_BLUE_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_POST_CONVOLUTION_ALPHA_SCALE\fP:float:1:(-\(if,\(if)
\%\f3GL_POST_CONVOLUTION_RED_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_POST_CONVOLUTION_GREEN_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_POST_CONVOLUTION_BLUE_BIAS\fP:float:0:(-\(if,\(if)
\%\f3GL_POST_CONVOLUTION_ALPHA_BIAS\fP:float:0:(-\(if,\(if)
_
.TE

.sp
\%\f3glPixelTransferf\fP 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 \f2pname\fP is an integer parameter,
\f2param\fP is rounded to the nearest integer.
.P
Likewise,
\%\f3glPixelTransferi\fP can be used to set any of the
pixel transfer parameters.
Boolean parameters are set to false if \f2param\fP is 0 and to true otherwise.
\f2param\fP is converted to floating point before being assigned to real-valued parameters.
.SH NOTES
If a
\%\f3glColorTable\fP,
\%\f3glColorSubTable\fP,
\%\f3glConvolutionFilter1D\fP,
\%\f3glConvolutionFilter2D\fP,
\%\f3glCopyPixels\fP,
\%\f3glCopyTexImage1D\fP,
\%\f3glCopyTexImage2D\fP,
\%\f3glCopyTexSubImage1D\fP,
\%\f3glCopyTexSubImage2D\fP,
\%\f3glCopyTexSubImage3D\fP,
\%\f3glDrawPixels\fP,
\%\f3glReadPixels\fP,
\%\f3glSeparableFilter2D\fP,
\%\f3glTexImage1D\fP,
\%\f3glTexImage2D\fP,
\%\f3glTexImage3D\fP,
\%\f3glTexSubImage1D\fP,
\%\f3glTexSubImage2D\fP, or
\%\f3glTexSubImage3D\fP.
command is placed in a display list
(see \%\f3glNewList\fP and \%\f3glCallList\fP),
the pixel transfer mode settings in effect when the display list is
.I executed
are the ones that are used.
They may be different from the settings when the command was compiled
into the display list.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2pname\fP is not an accepted value.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glPixelTransfer\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGet\fP with argument \%\f3GL_MAP_COLOR\fP
.br
\%\f3glGet\fP with argument \%\f3GL_MAP_STENCIL\fP
.br
\%\f3glGet\fP with argument \%\f3GL_INDEX_SHIFT\fP
.br
\%\f3glGet\fP with argument \%\f3GL_INDEX_OFFSET\fP
.br
\%\f3glGet\fP with argument \%\f3GL_RED_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_RED_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_GREEN_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_GREEN_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_BLUE_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_BLUE_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_ALPHA_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_ALPHA_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_DEPTH_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_DEPTH_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_COLOR_MATRIX_RED_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_COLOR_MATRIX_RED_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_COLOR_MATRIX_GREEN_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_COLOR_MATRIX_GREEN_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_COLOR_MATRIX_BLUE_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_COLOR_MATRIX_BLUE_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_COLOR_MATRIX_ALPHA_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_COLOR_MATRIX_ALPHA_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_CONVOLUTION_RED_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_CONVOLUTION_RED_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_CONVOLUTION_GREEN_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_CONVOLUTION_GREEN_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_CONVOLUTION_BLUE_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_CONVOLUTION_BLUE_BIAS\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_CONVOLUTION_ALPHA_SCALE\fP
.br
\%\f3glGet\fP with argument \%\f3GL_POST_CONVOLUTION_ALPHA_BIAS\fP
.SH SEE ALSO
\%\f3glCallList(3G)\fP,
\%\f3glColorTable(3G)\fP,
\%\f3glColorSubTable(3G)\fP,
\%\f3glConvolutionFilter1D(3G)\fP,
\%\f3glConvolutionFilter2D(3G)\fP,
\%\f3glCopyPixels(3G)\fP,
\%\f3glCopyTexImage1D(3G)\fP,
\%\f3glCopyTexImage2D(3G)\fP,
\%\f3glCopyTexSubImage1D(3G)\fP,
\%\f3glCopyTexSubImage2D(3G)\fP,
\%\f3glCopyTexSubImage3D(3G)\fP,
\%\f3glDrawPixels(3G)\fP,
\%\f3glNewList(3G)\fP,
\%\f3glPixelMap(3G)\fP,
\%\f3glPixelStore(3G)\fP,
\%\f3glPixelZoom(3G)\fP,
\%\f3glReadPixels(3G)\fP,
\%\f3glTexImage1D(3G)\fP,
\%\f3glTexImage2D(3G)\fP,
\%\f3glTexImage3D(3G)\fP,
\%\f3glTexSubImage1D(3G)\fP,
\%\f3glTexSubImage2D(3G)\fP,
\%\f3glTexSubImage3D(3G)\fP