Microsoft DirectX 8.0 (C++)

Accessing Direct3D

When a Microsoft® Direct3D® application written in C++ starts, it must obtain a pointer to an IDirect3D8 interface to access Direct3D functionality.

The following code example shows how to use the Direct3DCreate8 function to retrieve a pointer to the Direct3D interface.

LPDIRECT3D8 g_pD3D = NULL;

    if( NULL == (g_pD3D = Direct3DCreate8(D3D_SDK_VERSION)))
        return E_FAIL;

To navigate from the Direct3DDevice object to the Direct3D object that created the device, use the IDirect3DDevice8::GetDirect3D method.