Platform SDK: DirectX

Changing Depth Buffer Comparison Functions

[C++]

By default, when depth-testing is performed on a rendering surface, the Direct3D system updates the render-target surface if the corresponding depth value (z or w) for each point is less than the value already in the depth buffer. In a C++ application, you change how the system performs comparisons on depth values by calling the IDirect3DDevice7::SetRenderState method with the dwRenderStateType parameter set to D3DRENDERSTATE_ZFUNC. The dwRenderState parameter should be set to one of the values in the D3DCMPFUNC enumerated type.

[Visual Basic]

By default, when depth testing is performed on a rendering surface, the Direct3D system updates the render-target surface if the corresponding depth value (z or w) for each point is less than the value already in the depth buffer. In Visual Basic, you can change how the system performs comparisons on depth values by calling the Direct3DDevice7.SetRenderState method with the state parameter set to D3DRENDERSTATE_ZFUNC. The renderstate parameter should be set to one of the values in the CONST_D3DCMPFUNC enumeration.