Introduction to Direct3D Immediate-Mode Objects
Direct3D's Immediate Mode consists of API elements that create objects, fill them with data, and link them together. Direct3D's Retained Mode is built on top of Immediate Mode. For a description of the overall organization of the system and the organization of Immediate Mode in particular, see Direct3D Architecture.
The following table shows the eight object types in Immediate Mode, their Component Object Model (COM) interfaces, and a description of each:
Object type | COM interface and description |
Interface | IDirect3D Interface |
COM interface object | |
Device | IDirect3DDevice Interface |
Hardware device | |
Texture | IDirect3DTexture Interface |
DirectDraw surface containing an image | |
Material | IDirect3DMaterial Interface |
Surface properties, such as color and texture | |
Light | IDirect3DLight Interface |
Light source | |
Viewport | IDirect3DViewport Interface |
Screen region to draw to | |
Matrix | IDirect3DDevice Interface |
4-by-4 homogeneous transformation matrix | |
ExecuteBuffer | IDirect3DExecuteBuffer Interface |
List of vertex data and instructions about how to render it |
Rendering is done by using execute buffers. These buffers contain vertex data and a list of opcodes that, when interpreted, instruct the rendering engine to produce an image. The execute buffer COM object contains only pointers and some descriptions of the format of the buffer. The contents of the buffer are dynamically allocated and can reside in the memory of the graphics card.
Each of the objects can effectively exist in one or more of the following forms:
·A COM object.
·A structure exposed to the developer that effectively contains a copy of the data in the COM object. This form is typically used to copy data into or out of the actual COM object.
·A handle. In this case, the data resides on the hardware and can be manipulated by it.
The following table shows the forms in which each of the Direct3D objects can exist:
COM interface | Structure | Handle | |
Device | x | ||
Texture | x | x | x |
Material | x | x | x |
Light | x | x | |
Viewport | x | ||
Matrix | x | x | |
ExecuteBuffer | x | x |