Chapter 1 -- DirectX Fundamentals

[Previous] [Next]

Chapter 1

The Microsoft DirectX application programming interface (API) was developed to provide a set of interfaces that provide extremely efficient control of multimedia hardware on a computer running Microsoft Windows. DirectX lets programmers work with commands and data structures that are very close to those that the hardware can natively process, without being so low level that code has to be written differently for each device. By writing device-independent code, programmers can create software that will always perform at its best—even as users enhance their systems with new and improved 3D graphics accelerators, sound cards, input devices, and so on.

DirectX was designed to give developers an environment similar in performance to MS-DOS, which was historically much faster than Windows-based code because of the overhead imposed by earlier Windows multimedia APIs. By supporting all hardware features as they become available, however, DirectX code runs faster than would be possible in most MS-DOS applications. The DirectX API is built on a hardware abstraction layer (HAL) that hides the device-specific dependencies of the hardware. Because it is designed for future extensibility, DirectX defines a number of hardware acceleration support features that aren't available on much of the hardware built today. Such features are emulated through the hardware emulation layer (HEL) or ignored if the HEL doesn't support them either. When a device that accelerates a DirectX feature (such as advanced texturing) is introduced, you can replace your old device with the new one. The software you wrote with such great foresight will instantly use the acceleration features this new hardware supplies.

Whenever you create a DirectX object for a device, DirectX queries the hardware, which the HAL represents, for information on the device. This information is then used to fill up a table of cap bits. (The term cap bits is shorthand for capability bits.) The information in the cap bits is used to determine whether the hardware is capable of performing a particular operation or whether a HEL function must be used to emulate it.

Given that Microsoft has provided cap bits so that you can determine what features are provided in the hardware (the HAL) versus what features are only emulated through software (the HEL), you should decide what system configuration is the minimum acceptable setup and optimize your code to run as effectively as possible on this system. In other words, although you should avoid using the HEL except as a last resort, you still need to write your application assuming the HEL is the least common denominator. Then, by using any advanced features supported on target systems with more capable hardware than this minimum configuration, you can provide enhanced features in your games, such as advanced texturing, higher polygon complexity, or dynamic lighting, for users who have more powerful systems. Make sure your design takes advantage of as many advanced features as possible. Hardware capabilities are increasing rapidly, and gaming aficionados update their systems as often as they can afford to. If you design your software without looking ahead, you'll lose untold potential sales.



Inside Direct3D
Inside Direct3D (Dv-Mps Inside)
ISBN: 0735606137
EAN: 2147483647
Year: 1999
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net