DirectX SDK |
This section pertains only to application development in Visual Basic. See Direct3D Immediate Mode C/C++ Tutorials.
Once the depth buffer is created, you need to attach it to the surface that will be used as the render target. Do this by calling the DirectDrawSurface7.AddAttachedSurface method of the render-target surface. The ZBuffer application performs this with the following code:
' Attach the z-buffer surface to the back buffer surface. g_ddsBackBuffer.AddAttachedSurface g_ddsZBuffer
Once the depth buffer is attached to the render-target surface, the system will automatically use the depth buffer whenever depth buffering is enabled, as discussed in Step 4: Enable Depth Buffering.