Platform SDK: DirectX

Changing Depth Buffer Write Access

By default, the Direct3D system is allowed to write to the depth buffer. Most applications will leave writing to the depth buffer enabled, but there are some special effects that can be achieved by not allowing the Direct3D system to write to the depth buffer.

[C++]

You can disable depth buffer writes in C++ by calling the IDirect3DDevice7::SetRenderState method with the dwRenderStateType parameter set to D3DRENDERSTATE_ZWRITEENABLE and the dwRenderState parameter set to 0.

[Visual Basic]

You can disable depth buffer writes in a Visual Basic application by calling the Direct3DDevice7.SetRenderState method with the state parameter set to D3DRENDERSTATE_ZWRITEENABLE and the renderstate parameter set to 0.