What Is a Direct3D Device?

A Direct3D device is the rendering component of Direct3D. It encapsulates and stores the rendering state. In addition, a Direct3D device performs transformations and lighting operations, and rasterizes an image to a DirectDraw surface. Architecturally, Direct3D devices contain a transformation module, a lighting module, and a rasterizing module, as the following illustration shows.

Direct3D enables applications that utilize custom transformation and lighting models to bypass the Direct3D device's transformation and lighting modules. For details, see Vertex Formats.

Direct3D Immediate Mode devices support three device interfaces: IDirect3DDevice, IDirect3DDevice2, and IDirect3DDevice3. The IDirect3DDevice interface provides methods used for programming with execute buffers. However, this is a form of Direct3D development that is provided primarily for backward compatibility. The IDirect3DDevice2 interface introduced the DrawPrimitive methods of Direct3D programming. The IDirect3DDevice3 extends the DrawPrimitive functionality. The DrawPrimitive methods represent the preferred rendering approach. The interfaces share a few common methods that are useful in either programming style, and these methods are provided by all three interfaces for your convenience. For more information about the two rendering approaches, see Rendering.

Prior to the introduction of the IDirect3DDevice2 interface in DirectX 5.0, Direct3D devices were interfaces to DirectDrawSurface objects. The IDirect3DDevice2 interface implements a device-object model in which a Direct3DDevice object is entirely separate from DirectDraw surfaces. The IDirect3DDevice3 interface uses and extends the same device-object model. Because they are separated from DirectDraw surfaces and have independent lifetimes, Direct3D device objects are now able to use different DirectDraw surfaces as render targets at different times, if the application requires it. For information about rendering targets, see IDirect3DDevice3::SetRenderTarget.