Acquiring anIDirect3D9 Interface
This is easily doneusing a special Direct3D function, as the following lines of code show:
IDirect3D9*_d3d9;
_d3d9 =Direct3DCreate9(D3D_SDK_VERSION);
Checking for Hardware Vertex Processing
We use the followingmethod:
HRESULTIDirect3D9::GetDeviceCaps(
UINTAdapter,
D3DDEVTYPEDeviceType,
D3DCAPS9*pCaps
);
Adapter—Specifiesthe physical display adapter that we are going to get the capabilities of
DeviceType—Specifiesthe device type to use (e.g., hardware device (D3DDEVTYPE_HAL) or softwaredevice (D3DDEVTYPE_REF))
pCaps—Returnsthe initialized capabilities structure
Then we can checkthe capabilities, as we did in section 1.3.8. The following code snippetillustrates this:
// FillD3DCAPS9 structure with the capabilities of the
//primary display adapter.
D3DCAPS9caps;
d3d9->GetDeviceCaps(
D3DADAPTER_DEFAULT,// Denotes primary display adapter.
deviceType,// Specifies the device type, usually D3DDEVTYPE_HAL.
&caps);// Return filled D3DCAPS9 structure that contains
// thecapabilities of the primary display adapter.
// Canwe use hardware vertex processing?
int vp =0;