Device Interfaces

You use a device interface to manipulate a Direct3DDevice object's rendering states, lighting states, and to perform rendering operations. Although devices support three iterations of the device interface (IDirect3DDevice, IDirect3DDevice2, and IDirect3DDevice3), it is unlikely that your applications will need to use more than one of them at a time. Which interface you use should be determined by the rendering approach—the DrawPrimitive methods or execute buffers—your application is going to use. The following paragraphs provide additional information about these interfaces and the rendering approaches they represent:

Execute buffers

The IDirect3DDevice interface supports rendering through execute buffers; the original method of Direct3D programming. This interface is supported mostly for backward compatibility, as the DrawPrimitive rendering architecture is easier to use. It is recommended that you use the IDirect3DDevice3 interface for developing new applications, unless your application specifically targets versions of DirectX prior to DirectX 5.0.

All Direct3D device types support the IDirect3DDevice interface.

DrawPrimitive rendering

The two most recent iterations of the device interface, IDirect3DDevice3 and IDirect3DDevice2, support the DrawPrimitive family of rendering methods in favor of rendering with execute buffers. The DrawPrimitive methods greatly simplify the process of preparing and rendering vertices to the render target surface, and are widely considered the preferred rendering approach.

If your application uses the DrawPrimitive methods, there is little reason to use anything but the newest version of the device interface (in fact, this documentation provides information only for the most recent version). Direct3D, in compliance with COM standards for backward compatibility, supports all interface versions, but it is recommended that you use the most recent version to take advantage of any new features and performance enhancements.

The IDirect3DDevice2 interface, created for DirectX 5.0, introduced the DrawPrimitive rendering architecture. DrawPrimitive-based rendering methods are simpler to use than execute buffers and provide a more direct style of Direct3D programming. For details, see Rendering. All Direct3D device types support the IDirect3DDevice2 interface.

Like the IDirect3DDevice2 interface, the IDirect3DDevice3 interface provides support for the DrawPrimitive methods. In conjunction with the IDirect3D3 interface, it also sports an enhanced feature set which includes multiple texture blending, vertex buffers, and enhancements to the 3-D geometry rendering pipeline. The IDirect3DDevice3 interface furnishes the same methods that the IDirect3DDevice2 interface did. However, it adds new render states to the IDirect3DDevice3::SetRenderState method to support multiple texture blending.

All Direct3D device types support the IDirect3DDevice3 interface.