Next: 18.4 Tuning the Raster Up: 18.3 Tuning the Geometry Previous: 18.3.3 Optimizing Lighting Performance   Contents

### 18.3.4 Advanced Geometry-Limited Tuning Techniques

This section describes advanced techniques for tuning transform-limited drawing. Follow these guidelines to draw objects with complex surface characteristics:

• Use texture to replace complex geometry.

Texture mapping can be used instead of extra polygons to add detail to a geometric object. This can greatly simplify geometry, resulting in a net speed increase and an improved picture, as long as it does not cause the program to become fill-limited. However, since many hardware implementations are slower to fill textured pixels than non-textured pixels, large areas to be covered with a simple texture can often be drawn faster if drawn as geometry.

• Use textured polygons as single-polygon billboards.

Billboards are polygons that are fixed at a point and rotated about an axis, or about a point, so that the polygon always faces the viewer. Billboards can be used for distant objects to save geometry. Section 6.10 discusses how to render billboards.

• Use glAlphaFunc() in conjunction with one or more textures to give the effect of rather complex geometry on a single polygon.

Consider drawing an image of a complex object by texturing it onto a single polygon. Set alpha values to zero in the texture outside the image of the object. (The edges of the object can be antialiased by using alpha values between zero and one.) Orient the polygon to face the viewer. To prevent pixels with zero alpha values in the textured polygon from being drawn, call glAlphaFuncGL_ NOTEQUAL, 0.0(GL_ NOTEQUAL, 0.0).

This effect is often used to create objects like trees that have complex edges or many holes through which the background should be visible (or both).

• Eliminate objects or polygons that will be out of sight or too small to see. Section 5 discusses some techniques for occlusion culling.

Next: 18.4 Tuning the Raster Up: 18.3 Tuning the Geometry Previous: 18.3.3 Optimizing Lighting Performance   Contents
2001-01-10