Microsoft DirectX 9.0 SDK Update (October 2004)

Clearing Depth Buffers

Language:

Note: This documentation is preliminary and is subject to change.

Many C# applications clear the depth buffer before rendering each new frame. Through Microsoft® Direct3D®, the depth buffer can be cleared explicitly by calling Device.Clear and specifying ClearFlags.ZBuffer for the flags parameter. The Device.Clear method allows specification of an arbitrary depth value in the zdepth parameter.

The following C# code example demonstrates how to clear the depth buffer.

          [C#]
          
using Microsoft.DirectX.Direct3D; Device device = null; // Create a rendering device. . . . // Clear the depth buffer. device.Clear(ClearFlags.ZBuffer, 0, 0.5f, 0);

© 2004 Microsoft Corporation. All rights reserved. Terms of use.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center