GLPIXELTRANSFORMPARAMETEREXT(3GL)GLPIXELTRANSFORMPARAMETEREXT(3GL)NAME
glPixelTransformParameter*EXT - set pixel transformation parameters
C Specification
For Single-Value Attributes
void glPixelTransformParameterfEXT( GLenum target,
GLenum pname,
GLfloat param )
void glPixelTransformParameteriEXT( GLenum target,
GLenum pname,
GLint param )
PARAMETERS
target The target pixel transformation. Must be GL_PIXEL_TRANS‐
FORM_2D_EXT. pname The parameter to be set. Must be one of
GL_PIXEL_MIN_FILTER_EXT, GL_PIXEL_MAG_FILTER_EXT, or
GL_PIXEL_CUBIC_WEIGHT_EXT. param The parameter value. If pname
is GL_PIXEL_MAG_FILTER_EXT, param must be one of GL_NEAREST,
GL_LINEAR, or GL_CUBIC_EXT. If pname is GL_PIXEL_MIN_FIL‐
TER_EXT, param must be one of GL_NEAREST, GL_LINEAR,
GL_CUBIC_EXT or GL_AVERAGE_EXT. If pname is any of the other
accepted values, the specified parameter will be set to the
value of param.
C Specification
For Multiple-Value Attributes
void glPixelTransformParameterfvEXT( GLenum target,
GLenum pname,
const GLfloat *params )
void glPixelTransformParameterivEXT( GLenum target,
GLenum pname,
const GLint *params )
PARAMETERS
target The target pixel transformation. Must be GL_PIXEL_TRANS‐
FORM_2D_EXT. pname The parameter to be set. Must be one of
GL_PIXEL_MIN_FILTER_EXT, GL_PIXEL_MAG_FILTER_EXT, or
GL_PIXEL_CUBIC_WEIGHT_EXT. params The parameter value. If
pname is GL_PIXEL_MAG_FILTER_EXT, params must be one of
GL_NEAREST, GL_LINEAR, or GL_CUBIC_EXT. If pname is
GL_PIXEL_MIN_FILTER_EXT, params must be one of GL_NEAREST,
GL_LINEAR, GL_CUBIC_EXT or GL_AVERAGE_EXT. If pname is any of
the other accepted values, the specified parameter will be set
to the value of params.
DESCRIPTION
glPixelTransformParameter*EXT is part of the EXT_pixel_transform exten‐
sion, which adds image scaling, rotation, translation, and general
affine mapping to the pixel rasterizer immediately after the pixel
transfer path.
The EXT_pixel_transform extension is always enabled. It has its own
matrix stack, 32 deep, and is identified with GL_PIXEL_TRANS‐
FORM_2D_EXT. To use this new matrix mode use the call: glMatrix‐
Mode(GL_PIXEL_TRANSFORM_2D_EXT). All OpenGL matrix operator calls will
operate on this matrix stack, (ie. glLoadIdentity(), glLoadMatrix(),
glMultMatrix(), glPushMatrix(), glPopMatrix(), etc...) It is by using
the current matrix of the GL_PIXEL_TRANSFORM_2D_EXT matrix mode that
the pixel transformation is defined. After each matrix operator call,
the resulting matrix is then masked such that only the affine compo‐
nents, in the X and Y dimensions, are kept. See below:
Given Matrix P: P masked to preserve affine components:
| m0 m4 m8 m12| | m0 m4 0 m12|
P = | m1 m5 m9 m13| P = | m1 m5 0 m13|
| m2 m6 m10 m14| | 0 0 1 0|
| m3 m7 m11 m15| | 0 0 0 1|
The function void glPixelZoom( float zx, float zy ) ; will set the cur‐
rent pixel transformation matrix (the current top of the pixel trans‐
formation matrix stack) to the scaling matrix:
|zoomX 0 0 0|
| 0 zoomY 0 1|
| 0 0 1 0|
| 0 0 0 1|
The transformation is applied to the image in terms of the input
image's coordinates, where the lower left corner of the image has coor‐
dinates of (0,0). After the transformation is applied, the current
raster position is then added to the X, Y coordinates of the resulting
output image pixel coordinates, effectively translating the image pix‐
els before displaying to the window. If the current rastor position is
not valid, then no output is generated.
NOTES
GL_PIXEL_MIN_FILTER_EXT defines the resampling technique that is to be
applied if the image is minified by the scaling factors.
GL_PIXEL_MAG_FILTER_EXT establishes the resampling technique that is to
be used after the other image transformation operators have been
applied if the image is to have been magnified.
GL_PIXEL_CUBIC_WEIGHT_EXT defines the cubic weighting coefficient that
is to be used whenever the resampling technique is set to GL_CUBIC_EXT.
Pixel transformation is defined for pixel rectangles that contain
GL_COLOR_INDEX, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA, or
GL_ABGR_EXT components or depth components in pixel rastorization.
Since multiple input pixels can be mapped into a single output pixel
(minification of input image), or since output pixels might not have
any input pixels mapped to them (magnification of input image), some
method of resampling is required. If the resampling method is GL_NEAR‐
EST, each output pixel will have the value of the input pixel whose
transformed coordinate value is nearest (in Manhattan distance). If the
resampling method is GL_LINEAR, each output pixel will have a value
that is the weighted average of the four input pixels whose transformed
coordinate values are nearest.
If the resampling method is GL_CUBIC_EXT, each output pixel will have a
value that is affected by the 16 input pixels whose transformed coordi‐
nate values are nearest. The 16 input pixels will be used to perform a
cubic spline interpolation to determine the value of the output pixel.
The cubic weight factor is a floating point value that is applied to
the cubic interpolation in the manner described in "Digital Image Warp‐
ing" by George Wolberg (IEEE Computer Society Press, ISBN
0-8186-8944-7). Visually pleasing cubic weighting values are typically
in the range [-1,0]. The values -1.0 and -0.5 are most commonly used.
For the purpose of performing bicubic interpolation along the outer
edge of the pixel rectangle, the outermost one pixel edge of the pixel
rectangle is duplicated prior to performing the interpolation along the
edges.
If the resampling method is GL_AVERAGE_EXT, the values of all of the
input pixels that contribute to the final output pixel will be averaged
to determine the final output pixel value. That is, an output pixel is
backward mapped into the input pixel rectangle, then the nearest neigh‐
bor resampling method determines the address of the center input pixel
from which input pixels will be averaged. All pixels in the input that
forward map into the same location in the output pixel rectangle will
be added together and divided by the total number of input pixels which
contribute the same output pixel. For example, if the output pixel rec‐
tangle is 1/3 the size of the input pixel rectangle, then a total of 9
pixels would be read from the input pixel rectangle, averaged, and then
the new single value will be written into the output pixel rectangle.
DEFAULTS
The default current matrix for the matrix mode GL_PIXEL_TRANS‐
FORM_2D_EXT is the identity matrix. While the current matrix is the
identity matrix for the matrix mode GL_PIXEL_TRANSFORM_2D_EXT, no pixel
transform operation will be performed. Only when this current matrix is
not an identity matrix will the pixel tranformation take place. The
default value for the cubic weighting factor is -1.0. The default mini‐
fication and magnification filters are GL_NEAREST.
ERRORS
GL_INVALID_ENUM is generated if target or pname is not an acceptable
value. GL_INVALID_ENUM is generated if pname is GL_PIXEL_MAG_FILTER_EXT
and the specified parameter value is not one of GL_NEAREST, GL_LINEAR,
or GL_CUBIC_EXT. GL_INVALID_ENUM is generated if pname is
GL_PIXEL_MIN_FILTER_EXT and the specified parameter value is not one of
GL_NEAREST, GL_LINEAR, GL_CUBIC_EXT, or GL_AVERAGE_EXT.
SEE ALSO
glGetPixelTransformParameterEXT
24 Sept 97 GLPIXELTRANSFORMPARAMETEREXT(3GL)