Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
97 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

by Nathan Davies from Alamar's Domain

  Contents

 Introduction
 Display Drivers
 Display Modes
 D3D Devices
 Cleanup and
 Conclusion


 Printable version

 


Enumerating Devices

To be able to enumerate the Devices, a valid Direct3D object must be available. This is achieved by using QueryInterface on the DirectDraw object as shown below:

// QueryInterface for the Direct3D Object pDirectDraw->QueryInterface( IID_IDirect3D7, ( void** ) &pDirect3D );

The call to enumerate Direct3D Devices is EnumDevices(). The parameters passed are: the pointer to any variable you wish to pass, and the pointer to the callback function For Example:

pDirect3D->EnumDevices(( LPD3DENUMDEVICESCALLBACK7 )EnumDevices, &( TheDD->D3DDeviceList ));

EnumDevices will be called once for each Device found. Notice that I passed the address of the current DisplayDriver's D3DDeviceList variable. The code for EnumDevices follows

Popup : EnumDevices

In EnumDevices, a variable is declared to refer to the D3DDeviceList value passed. A new D3DDevice variable is then allocated. This structure is filled with the relevant information that was passed to this function. As opposed to the Display Driver information, the Name is more useful for our purposes. The GUID is saved, as well as a BOOL flag to indicate whether the Device is Hardware or Software. Next, the Device is added to the end of the D3DDeviceList passed.


Next : Cleanup and Conclusion