Microsoft DirectX 9.0

Direct3D Object

Microsoft?Direct3D?is implemented through Component Object Model (COM) objects and interfaces. Applications written in C++ access these interfaces and objects directly, whereas Microsoft Visual Basic?applications interact with a layer of code—visible as the Microsoft DirectX?for Visual Basic Classes—that marshals data from a Visual Basic application to the DirectX run time.

The Direct3D object is the first object that your application creates and the last object that your application releases. Functions for enumerating and retrieving capabilities of a Direct3D device are accessible through the Direct3D object. This enables applications to select devices without creating them.

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

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


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

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

© 2002 Microsoft Corporation. All rights reserved.