IDirect3D2 Interface

A more straightforward style of Direct3D programming was introduced with the IDirect3D2 interface. This programming style is based on rendering primitives with a single call rather than rendering through an execute buffer. Devices exposed two methods for this new rendering style, IDirect3DDevice2::DrawPrimitive and IDirect3DDevice2::DrawIndexedPrimitive methods; these methods are supported in the most recent device interface, IDirect3DDevice3.

Applications get a pointer to the IDirect3D2 interface from a DirectDraw object using the QueryInterface method.

The IDirect3D2 interface is the starting point for creating other Direct3D Immediate Mode interfaces. Using it, your application can find and enumerate the types of Direct3D devices supported by a particular DirectDraw object. It also has methods needed to create other Direct3D Immediate Mode objects, such as viewports, materials and lights.

One of the most important differences between IDirect3D2 and its predecessor, IDirect3D, is that IDirect3D2 implements an IDirect3D2::CreateDevice method. This method creates a Direct3D device that supports the DrawPrimitive methods. For more information about the devices created by the IDirect3D2::CreateDevice method, see Direct3D Devices.

Note also that You cannot use new features that the IDirect3DDevice2 interface offers with IDirect3DDevice interface pointers. If your application calls the QueryInterface method on a DirectDraw surface and retrieves an IDirect3DDevice, it cannot access the features supported by later device interfaces. In addition, it cannot call the QueryInterface method on a device object created in this way to retrieve an IDirect3DDevice2 interface.