Next | Prev | Up | Top | Contents | Index

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, don't clear each buffer independently. Instead use

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)

Next | Prev | Up | Top | Contents | Index