next up previous contents
Next: 18.5 Rendering Geometry Efficiently Up: 18.4 Tuning the Raster Previous: 18.4.3 Optimizing Texture Mapping

18.4.4 Clearing the Color and Depth Buffers Simultaneously

The most basic per-frame operations are clearing the color and depth buffers. On some systems, there are optimizations for common special cases of these operations.

Whenever you need to clear both the color and depth buffers, do not clear each buffer independently. Instead use glClearGL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT).

Also, be sure to disable dithering before clearing.

David Blythe