General Information about Texture Mapping


For a list of related topics and for a list of all texture mapping functions, see Texture Mapping.

Texture mapping simulates material properties for surface primitives by adding visual detail with color. This is accomplished by blending the sampling of a map of colors with the primitive's color.

Texture mapping is enabled by setting the interior style to PEXInteriorStyleTexture. When face distinguishing is enabled and a primitive is back- facing, the backface interior style is used instead. If none of the other texture mapping controls have been set, by default a black and white checkerboard texture will be applied to surface primitives.

Texture maps are defined by creating texture map PEX resources. Only color mipmap texture maps are supported. A color mipmap is a pre-computed area sampling mechanism which fixes the cost of approximating the average color over a large number of texels (the individual components of a texture map). It is created as a pyramid of down-sampled levels, from the "base" to the typically single-texel "pinnacle". Each level is a 1D, 2D, or 3D array of texels, according to the dimension of the texture map. Typically each texel in level n equals the average of four texels beneath it in level n-1. Thus the resolution of each map typically becomes half of the preceding level until the top level, or pinnacle, is reached, which typically has one texel representing the average color of the original base level map. So, if multiple levels are defined, then an array of texels is defined for each level.

The texel types are luminance, luminance and alpha, red- green-blue, and red-green-blue-alpha, in a variety of data formats. A texture map is created with function PEXCreateMipmap which accepts the color mipmap levels as arrays of texels. Alternately, the function PEXCreateMipmapTMFromResources creates a color mipmap from a list of resources, such as drawables, image buffers, pixmaps, or photomaps, where each resource defines one level of the mipmap. A second list of resources is used if the texels include an alpha component.

A texture map resource is enabled by referencing it from an entry of the texture mapping lookup table and enabling that entry with the pipeline state's active textures, modified with the PEXOCCSetSurfaceActiveTextures OC. The corresponding bf active textures pipeline state field, modified with the PEXOCCSetBFSurfaceActiveTextures OC, is applied to back-facing surfaces when face distinguishing is enabled. An application can select multiple texture maps.