DirectX SDK

Immediate Mode Object Types

Direct3D Immediate Mode is made up of a series of objects. When programming with C++, you work directly with these objects to manipulate your virtual world and build a Direct3D application. A Visual Basic application ultimately accesses these objects as well, although DirectX for Visual Basic exposes a slightly different object model.

[C++]
DirectDraw Object
A DirectDraw object provides the functionality of Direct3D; IDirect3D, IDirect3D2, IDirect3D3, and IDirect3D7 are interfaces to a DirectDraw object. Since a DirectDraw object represents the display device and the display device implements many of the most important features of Direct3D, the abilities of Direct3D are incorporated into DirectDraw. The IDirect3D7 interface is an interface to an entirely different object than its predecessors. For more information, see Direct3D Interfaces. Like Direct3D, the method by which you create the DirectDraw object determines what interfaces you can use.

Create a DirectDraw object that can support the newest Direct3D interface by calling the DirectDrawCreateEx function. For more information, see Direct3D Interfaces.

DirectDrawSurface Object
A DirectDrawSurface object that was created with 3-D capabilities (DDSCAPS_3DDEVICE) can be used to create a Direct3D device object that uses the surface as its rendering target. Applications create a device from a surface by calling the IDirect3D7::CreateDevice method.

A DirectDrawSurface object that was created with texture-mapping capabilities contains the bitmap(s) that your Direct3D application uses for texturing objects in a scene. Applications use a pointer to the surface's IDirectDrawSurface7 interface to identify the texture to Direct3D. Applications create a texture and retrieve its interface pointer by calling the IDirectDraw7::CreateSurface method. (This is a change from the method by which applications previously created textures, retrieving the IDirect3DTexture2 interface for the surface by calling the IUnknown::QueryInterface method, and specifying the IID_IDirect3DTexture2 reference identifier.)

For more information, see Textures.

Direct3DDevice Object
A Direct3DDevice object encapsulates and stores the rendering state for an Immediate Mode application. Direct3D devices are independent of the surfaces they use as rendering targets, and devices can be used to render to several render-target surfaces (prior to DirectX 5.0, this was not the case). In DirectX 7.0, the recommended device object exposes the IDirect3DDevice7 interface. Direct3D applications can create a device and retrieve a pointer to its IDirect3DDevice7 interface by calling the IDirect3D7::CreateDevice method. A device object created in this manner only exposes the most recent interface. For details, see Device Interfaces and Direct3D Devices.

Unlike its predecessors, a device object that exposes the IDirect3DDevice7 interface does not employ separate objects for materials, lights, and viewports; these objects are effectively obsolete with DirectX 7.0. Rather, the new interface includes methods that provides the functionality of these legacy objects as part of the internal data structures for the device.

Direct3DVertexBuffer Object
A Direct3DVertexBuffer object is a memory buffer that contains vertices to be rendered with the vertex-buffer rendering methods offered in the IDirect3DDevice7 interface. Vertex buffers are not to be confused with the legacy execute buffer architecture. A vertex buffer contains only vertex data to be processed by a Direct3DDevice object and offers features to improve performance during rendering. To create a vertex buffer and retrieve an interface for it, call the IDirect3D7::CreateVertexBuffer method.

For more information, see Vertex Buffers.

[Visual Basic]

DirectX for Visual Basic exposes the following classes for Direct3D Immediate Mode programming:

DirectX7 Class
The DirectX7 class defines the object that is used to create all other component-level objects, such as the Direct3D7 or DirectDraw7 object.
DirectDraw7 Class
The DirectDraw7 class represents the display device, spawns the Direct3D7 class, and creates the texture and rendering target surfaces used for rendering. To create an object of the DirectDraw7 class, call the DirectX7.DirectDrawCreate method.
DirectDrawSurface7 Class
The DirectDrawSurface7 class represents memory that is used to contain image data for display, texturing, or as a rendering target for a Direct3D device. Call the DirectDraw7.CreateSurface method to create an empty surface, or call the DirectDraw7.CreateSurfaceFromFile method to create a surface and load it with image data from a bitmap file.
Direct3D7 Class
The Direct3D7 class defines an object that provides the functionality of Direct3D, used to create and manipulate the objects that you need to render a scene. To create an object of the Direct3D7 class, call the DirectDraw7.GetDirect3D method.
Direct3DDevice7 Class
The Direct3DDevice7 class defines an object that encapsulates and stores the rendering state, lighting and material states, and viewport parameters for an Immediate Mode application written in Visual Basic. To create an object of this class, call the Direct3D7.CreateDevice method. For more information, see Direct3D Devices, Lighting and Materials, and Viewports and Clipping.
Direct3DEnumDevices Class
The Direct3DEnumDevices class defines an object that can enumerate the rendering devices present on a system. To create an object of the Direct3DEnumDevices class, call the Direct3D7.GetDevicesEnum method.
Direct3DEnumPixelFormats Class
The Direct3DEnumPixelFormats class defines an object that can enumerate the pixel formats supported for a given device on a system. To create an object of the Direct3DEnumPixelFormats class, call the Direct3D7.GetEnumZBufferFormats or Direct3DDevice7.GetTextureFormatsEnum methods.
Direct3DVertexBuffer7 Class
The Direct3DVertexBuffer7 class defines an object that acts as a memory buffer for vertices. Vertices in a vertex buffer can be rendered with the vertex-buffer rendering methods offered in the Direct3DDevice7 class. Call the Direct3D7.CreateVertexBuffer method to create a vertex buffer.

For more information, see Vertex Buffers.