glPixelTexGenEXT

NAME

glPixelTexGenEXT - control the generation of texture coordinates from a color image

C SPECIFICATION

void glPixelTexGenEXT(GLenum mode)

PARAMETERS

mode Specifies a mode of generating texture coordinates from a color image. Must be one of the following: GL_NONE, GL_ALPHA, GL_RGB and GL_RGBA. The default value is GL_NONE.

DESCRIPTION

glPixelTexGenEXT affects the result of the glDrawPixels and glCopyPixels commands. It allows the color components of fragment color which was generated from a color image to be used as texture coordinates, effectively converting a color image into a texture coordinate image. Because texture mapping is essentially a multi-dimensional table lookup, this conversion supports multi-dimensional color lookups for images. Such multi-dimensional lookups can be used to implement very accurate color space conversions.

When pixel texture generation is enabled, the color in each fragment is used as a texture coordinate according to the following:

Image Component Texture Component
Reds
Greent
Bluer
Alphaq

Components of the original fragment color are replaced based on the setting of mode. The current raster position color is used to replace the components according to the following table:

mode Red Green Blue Alpha
GL_NONEFragment RedFragment GreenFragment BlueFragment Alpha
GL_ALPHAFragment RedFragment GreenFragment BlueRasterPos Alpha
GL_RGBRasterPos RedRasterPos GreenRasterPos BlueFragment Alpha
GL_RGBARasterPos RedRasterPos GreenRasterPos BlueRasterPos Alpha

The operation of pixel texture generation during pixel copy operations is identical to the operation during pixel drawing. Because PixelTexGenEXT defines the rasterization of fragments, it has no effect on texture definitions or on glReadPixels operations.

EXTENSIONS

Some routines and constants for this function are part of an extension, not part of the core GL command set. The following extension names must be present in the string returned by glGetString when called with argument GL_EXTENSIONS to use these routines and constants.
GL_EXT_pixel_texture
PixelTexGenEXT, GL_PIXEL_TEX_GEN_EXT, and GL_PIXEL_TEX_GEN_MODE_EXT are part of the EXT_pixel_texture extension.

ERRORS

GL_INVALID_ENUM is generated when mode is not an accepted defined value.

GL_INVALID_OPERATION is generated if glClear is executed between the execution of glBegin and the corresponding execution of glEnd.

ASSOCIATED GETS

glGet with argument GL_PIXEL_TEX_GEN_MODE_EXT
glIsEnabled with argument GL_PIXEL_TEX_GEN_EXT

SEE ALSO

glCopyPixels, glDrawPixels, glEnable