DirectX SDK

Tutorial 4: Using Device Enumeration

[Visual Basic]

The information in this section pertains only to applications written in C and C++. See Direct3D Immediate Mode Visual Basic Tutorials.

[C++]

Device enumeration is useful because it allows applications to query hardware for the Direct3D devices that the hardware supports. As a result, you can build applications that take advantage of particular hardware configurations, or you can let the user choose a particular configuration supported by their system's hardware. The Using Device Enumeration tutorial enumerates the drivers, display modes, and devices on your system and then creates a list of supported display modes for each device.

Basically, device enumeration can be partitioned into two broad steps: (1) initiating and completing device enumeration and (2) selecting an enumerated device.

The Device Enumeration tutorial mirrors this process with the following sections:

For more information on Direct3D devices, see Direct3D Devices.

For more information on device enumeration, see Enumerating Direct3D Devices.

Note  The code in the Enumeration application is similar to the code in the Triangle application. This tutorial focuses only on the device enumeration code unique to the Enumeration application, and does not cover setting up Direct3D, preparing scene geometry, shutting down, or processing system events. For information on these tasks, see Tutorial 1: Rendering a Single Triangle.

The Device Enumeration tutorial uses a depth buffer to store depth information for the scene. To use depth buffering, you must enumerate supported depth-buffer formats, create a depth-buffer surface, attach the depth-buffer surface to a render-target surface, and enable depth buffering for the rendering device. For information on these tasks, see Tutorial 2: Adding a Depth Buffer.

The Device Enumeration tutorial draws a series of cone primitives. For more information on how to draw primitives, see Tutorial 3: Using Alternate Primitive Styles.