|
|
|
|
Enabling Depth Buffering |
After creating a depth buffer (as described in Creating a Depth Buffer), you enable depth buffering by setting the RenderStateManager.ZBufferEnable property of the Device.RenderState property to true. To enable w-buffering, set the device's render state RenderStateManager.UseWBuffer property to true. These steps are illustrated in the following C# code example.
[C#]
using System;
using Microsoft.DirectX.Direct3D;
// Declare a rendering device.
Device device = null;
// Initialize the device.
.
.
.
// Get the device's render state object.
RenderStates rs = device.RenderState;
// Enable depth buffering.
rs.ZBufferEnable = true;
// Render the scene.
.
.
.
// Disable depth buffering
// (note the different syntax; both forms are acceptable)
device.RenderState.ZBufferEnable = false;
// Use w-buffering.
device.RenderState.UseWBuffer = true;
Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center