Game Development Reference
In-Depth Information
The pixel with the depth value closest to the camera wins, and that
pixel gets written. This makes sense because the pixel closest to the
camera obscures the pixels behind it.
The format of the depth buffer determines the accuracy of the
depth test. That is, a 24-bit depth buffer is more accurate than a 16-bit
depth buffer. In general, most applications work fine with a 24-bit depth
buffer, although Direct3D also exposes a 32-bit depth buffer.
D3DFMT_D32 —Specifies a 32-bit depth buffer
D3DFMT_D24S8 —Specifies a 24-bit depth buffer with 8 bits
reserved as the stencil buffer
D3DFMT_D24X8 —Specifies a 24-bit depth buffer only
D3DFMT_D24X4S4 —Specifies a 24-bit buffer with 4 bits reserved
for the stencil buffer
D3DFMT_D16 —Specifies a 16-bit depth buffer only
Note: The stencil buffer is a more advanced topic and is explained
in Chapter 8.
1.3.7 Vertex Processing
Vertices are the building blocks for 3D geometry, and they can be pro-
cessed in two different ways, either in software ( software vertex
processing ) or in hardware ( hardware vertex processing ). Software vertex
processing is always supported and can always be used. On the other
hand, hardware vertex processing can only be used if the graphics card
supports vertex processing in hardware.
Hardware vertex processing is always preferred since dedicated
hardware is faster than software. Furthermore, performing vertex pro-
cessing in hardware unloads calculations from the CPU, which implies
that the CPU is free to perform other calculations.
Note: Another way of saying a graphics card supports hardware
vertex processing in hardware is to say that the graphics card supports
transformation and lighting calculations in hardware.
1.3.8 Device Capabilities
Every feature that Direct3D exposes has a corresponding data member
or bit in the D3DCAPS9 structure. The idea is to initialize the members
of a D3DCAPS9 instance based on the capabilities of a particular hard-
ware device. Then, in our application, we can check if a device supports
a feature by checking the corresponding data member or bit in the
D3DCAPS9 instance.
Team-Fly ®
Search WWH ::




Custom Search