Next: 18.4.4 Clearing the Color
Up: 18.4 Tuning the Raster
Previous: 18.4.2.3 Use the Depth
Follow these guidelines when rendering textured objects:
- Avoid frequent switching between texture maps. If you have many small
textures, consider combining them into a single larger, mosaiced texture.
Rather than switching to a new texture before drawing a textured polygon
choose texture coordinates that select the appropriate small texture tile
within the large texture.
- Use texture objects to encapsulate texture data. Place all the
glTexImage() calls (including mipmaps) required to completely
specify a texture and the associated glTexParameter() calls (which set
texture properties) into a texture object and bind this texture object to
the rendering context. This allows the implementation to compile the texture
into a format that is optimal for rendering and, if the system accelerates
texturing, to efficiently manage textures on the graphics adapter.
- Try to keep texture references localized between polygons. Some
implementations use caching to optimize texture mapped rendering.
Keeping the texture references localized when sending a batch of
polygons to OpenGL can reduce the cache misses.
- If possible, use glTexSubImage*D() to replace all or part of an
existing texture image rather than the more costly operations of deleting
and creating an entire new image.
- Call glAreTexturesResident() to make sure that all your textures
are resident during rendering. (On systems where texturing is done on the
host, glAreTexturesResident() always returns GL_TRUE.) If
necessary, reduce the size or internal format resolution of your textures
until they all fit into memory. If such a reduction creates intolerably
fuzzy textured objects, you may use higher resolutions and specify which
textures are important to keep in texture memory by using
glPrioritizeTextures().
- Use smaller texel sizes. There is often a tradeoff
between texel size and the speed of texture filtering, with smaller texel
sizes typically performing better. Applications should try to minimize the
width of a texel internal format to something like GL_RGBA4 or
GL_RGB5_A1 for color textures and 8 bit components for luminance
or luminance alpha textures unless the application requires the extra color
resolution.
- Avoid expensive texture filter modes. On some systems, trilinear
filtering is much more expensive than point sampling or bilinear filtering.
Next: 18.4.4 Clearing the Color
Up: 18.4 Tuning the Raster
Previous: 18.4.2.3 Use the Depth
David Blythe
1999-08-06