Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
When Microsoft® Direct3D® Mobile renders a primitive, it maps the 3-D primitive onto a 2-D screen. If the primitive has a texture, Direct3D Mobile must use that texture to produce a color for each pixel in the primitive's 2-D rendered image. For every pixel in the primitive's on-screen image, it must obtain a color value from the texture. This process is called texture filtering.
When a texture filter operation is performed, the texture being used is typically also being magnified or minified. In other words, it is being mapped onto a primitive image that is larger or smaller than itself. Magnification of a texture can result in many pixels being mapped to one texel. The result can be a chunky appearance. Minification of a texture often means that a single pixel is mapped to many texels. The resulting image can be blurry or aliased. To resolve these problems, some blending of the texel colors must be performed to arrive at a color for the pixel.
Direct3D Mobile simplifies the complex process of texture filtering. It provides you with three types of texture filtering — linear filtering, anisotropic filtering, and mipmap filtering. If you select no texture filtering, Direct3D Mobile uses a technique called nearest-point sampling.
Each type of texture filtering has advantages and disadvantages. For instance, linear texture filtering can produce jagged edges or a chunky appearance in the final image. However, it is a computationally low-overhead method of texture filtering. Filtering with mipmaps usually produces the best results, especially when combined with anisotropic filtering. However, it requires the most memory of the techniques that Direct3D Mobile supports.
Applications that use texture interface pointers should set the current texture filtering method by calling the IDirect3DMobileDevice::SetTextureStageStatemethod. Set the value of the first parameter to the integer index number (0-7) of the texture for which you are selecting a texture filtering method. Pass one of the D3DMTEXTURESTAGESTATETYPEenumeration values D3DMTSS_MAGFILTER, D3DMTSS_MINFILTER, or D3DMTSS_MIPFILTER for the second parameter to set the magnification, minification, or mipmapping filter. Pass a member of the D3DMTEXTUREFILTERTYPEenumerated type as the value in the third parameter to set the magnification, minification, or mipmapping filter.
The following topics present the texture filtering methods that Direct3D Mobile supports.
-
Nearest-Point
Sampling
-
Linear Texture
Filtering
-
Anisotropic
Texture Filtering
-
Texture
Filtering with Mipmaps
Note: Although the texture-filtering render states present in the D3DMRENDERSTATETYPEenumerated type are superseded by texture stage states, the IDirect3DMobileDevice::SetRenderStatecall does not fail if you attempt to use them. Rather, the system maps the effects of these render states to the first stage in the multitexture cascade, stage 0. Applications should not mix the legacy render states with their corresponding texture stage states, as unpredictable results can occur.