Article ID: 175334
Article Last Modified on 2/23/2007
LPDIRECT3D2 lpD3D2;
// Query the IDirect3D2 interface off of the desired DirectDraw object
rval = lpDD->QueryInterface(IID_IDirect3D2, (void**) &lpD3D2);
if (rval != DD_OK) {
// Creation of the IDirect3D2 interface failed.
lpDD->Release();
return FALSE;
}
/*
* Enumerate the drivers.
*/
rval = lpD3D2->EnumDevices(enumDeviceFunc, &NumDriver);
if (rval != DD_OK) {
// Enumeration of drivers failed.
return FALSE;
}
Now, in the enumDeviceFunc callback function, you can check for the MMX Emulation driver with the following code:
static HRESULT
WINAPI enumDeviceFunc(LPGUID lpGuid, LPSTR lpDeviceDescription,
LPSTR lpDeviceName, LPD3DDEVICEDESC lpHWDesc,
LPD3DDEVICEDESC lpHELDesc, LPVOID lpContext)
{
if (!memcmp(lpGuid, &IID_IDirect3DMMXDevice, sizeof(GUID))) {
// The MMX driver is being enumerated. Record "lpGuid" for
// later use if desired.
return D3DENUMRET_OK;
}
. . .
. . .
. . .
The major difference between the IDirect3D2 and the IDirect3D interface is
the addition of the CreateDevice method. This method creates a Direct3D
device to be used with the DrawPrimitive methods. To use execute buffers
with an MMX device, you can call the IDirect3D2::CreateDevice method to
create an MMX IDirect3DDevice2 interface and then use the QueryInterface() method to create an IDirect3DDevice interface from IDirect3DDevice2.
172947 SAMPLE: Rendering a Triangle with the Direct3D Immediate Mode
Keywords: kbdirect3dim kbfaq kbhowto KB175334