Platform SDK: DirectX |
After you create a depth buffer (as described in Creating a Depth Buffer), enabling depth buffering is as simple as calling the IDirect3DDevice7::SetRenderState method. Set the D3DRENDERSTATE_ZENABLE render state to enable depth-buffering. Use the D3DZB_TRUE value (or TRUE) to enable z-buffering, D3DZB_USEW to enable w-buffering, or D3DZB_FALSE (or FALSE) to disable depth buffering.
Note To use w-buffering, your application must set a compliant projection matrix even if it doesn't use the Direct3D transformation pipeline. For information about providing an appropriate projection matrix, see A W-Friendly Projection Matrix. (The projection matrix discussed in What Is the Projection Transformation? is compliant.)
After you create a depth buffer (as described in Creating a Depth Buffer), enabling depth buffering is as simple as calling the Direct3DDevice7.SetRenderState method. Set the D3DRENDERSTATE_ZENABLE render state to enable depth-buffering. Use the D3DZB_TRUE member of the CONST_D3DZBUFFERTYPE enumeration to enable z-buffering, D3DZB_USEW to enable w-buffering, or D3DZB_FALSE to disable depth buffering altogether.
Note To use w-buffering, your application must set a compliant projection matrix even if it doesn't use the Direct3D transformation pipeline. For information about providing an appropriate projection matrix, see A W-Friendly Projection Matrix. (The projection matrix discussed in What Is the Projection Transformation? is compliant.)