glPixelTexGenSGIX(3G) OpenGL Reference glPixelTexGenSGIX(3G)
glPixelTexGenSGIX - affects the generation of texture coordinates from
pixel groups
void glPixelTexGenSGIX( GLenum mode )
mode Specifies a mode of generating texture coordinates from pixel
groups. Must be one of the following: GL_NONE, GL_RGBA, GL_RGB,
GL_ALPHA. GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX,
GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX,
GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX, or GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX.
The default value is GL_NONE.
The pixel texgen function is enabled by calling glEnable and disabled by
calling glDisable with GL_PIXEL_TEX_GEN_SGIX. Pixel texgen affects the
result of the glDrawPixels and glCopyPixels commands. It allows the
color components of pixel groups to be used as texture coordinates,
effectively converting a color image into a texture coordinate image.
Because texture mapping is essentially a multidimensional table lookup,
this conversion supports multidimensional color lookups for images. Such
multidimensional lookups can be used to implement very accurate color
space conversions.
When pixel texgen is enabled, the red, green, blue, and alpha components
are used to generate s, t, r, and q texture coordinates, respectively. If
a valid texture has been defined, and texture-mapping enabled, these
texture coordinates will produce, in effect, a function of the color
components, which can then be blended with the original color components,
according to the texture environment blend function.
Alternatively, this mode command can be used to replace the fragment
color with the current raster position's color values. For example,
calling glPixelTexGenSGIX with GL_ALPHA will cause the fragment alpha to
be the alpha of the current raster position.
A useful mode of pixel texture is to have a pixel group with the external
format GL_RGBA index into a 3D texture, and have the alpha component
combined with the texel output. In this case the internal format of the
texture must have alpha, and that alpha can be replaced by the "incoming"
alpha by calling glPixelTexGenSGIX with the parameter
GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX. The "alpha replace" mode can be
turned off by calling glPixelTexGenSGIX with the parameter
GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX, the default.
Page 1
glPixelTexGenSGIX(3G) OpenGL Reference glPixelTexGenSGIX(3G)
Currently Silicon Graphics machines that support glPixelTexGenSGIX in
hardware do not have quad-linear interpolation. So the fourth dimension
of interpolation, q, defaults to nearest-neighbor mode (the other
dimensions may still be linear, depending on the glTexParameter call).
In order to achieve a true quad-linearly interpolated result, a two-pass
operation is required, which uses the frame buffer blend for the last
interpolation. For this purpose special ceiling/floor functions for the q
dimension have been supplied, which can be referenced in the man pages
for glTexParameter. These are
GL_PIXEL_TEX_GEN_Q_CEILING_SGIX [Toc] [Back]
GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX [Toc] [Back]
GL_PIXEL_TEX_GEN_Q_ROUND_SGIX [Toc] [Back]
On the second pass, use the "alpha replace" mode (described above) to
combine the incoming alpha with the output (as well as using it in the
fourth dimensional texture lookup). The original alpha, however, is not
usable as a fractional interpolation value until it gets left-shifted by
the number of bits corresponding to the logarithm (base 2) of the q size
of 4D texture. The alpha can be effectively left-shifted using the
texture color table. Since the table has limited precision, a mode is
supplied which will left-shift the alpha by 4 bits before combining it
with the output. To use it call glPixelTexGenSGIX with the parameter
GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX. The default, with no left shift, is
GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX (MS and LS refer to "most significant" and
"least significant"). This produces excellent results for 8 and 12 bit
components, for different texture q sizes.
GL_INVALID_ENUM is generated when mode is not an accepted defined value.
MACHINE DEPENDENCIES
glPixelTexGenSGIX is supported only on High Impact and Maximum Impact
systems; however, only 3D and 4D textures can be used.
On High Impact and Maximum Impact systems, the effect of the current
raster position's color is not taken into account, as if the color is
white, with full alpha. Also, the default and only supported mode is
GL_RGBA, meaning that the fragment color is limited to this constant
color. Additional functionality is provided in the
SGIX_impact_pixel_texture extension on High Impact and Maximum Impact
systems.
On High Impact and Maximum Impact systems, glPixelTexGenSGIX for
glCopyPixels is not supported.
Page 2
glPixelTexGenSGIX(3G) OpenGL Reference glPixelTexGenSGIX(3G)
glTexEnv, glTexImage1D, glTexImage2D, glTexImage3DEXT, glTexImage4DSGIS,
glTexParameter
PPPPaaaaggggeeee 3333 [ Back ]
|