Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
99 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 What is IM?
 Execute Buffers
 Steps to Create
 an Application

 Scene Management
 Sample App
 IM Objects
 DrawPrimitive
 Comparing Modes
 Summary

 Printable version

 


Immediate Mode Objects

As compared to the object in the retained mode, the number of objects provided by the immediate mode, are not many. A large number of object provided by the retained mode are convenience objects, which help in the management of the 3D data at hand. In the immediate mode, all the functionality provided by the retained mode object has to be provided by the application, using the execute buffers. The objects provided by immediate mode are sufficient to manage 3D data, but some additional amount of work will have to be done by the application.

Some of the objects provided by immediate mode are described in the following subsections.

IDirect3DDevice

Used to interface to a DirectDrawSurface object. A device object, has its own list of execute buffers, viewports, textures and materials. As we have mentioned before, only textures and materials can be shared across devices. An execute buffer is owned by only one viewport and a viewport is owned by only one device at a time.

This object provides methods to report the hardware capabilities of the system. It also provides methods to manage the textures and execute buffers, like maintaining the list of texture, manipulating the matrix objects and executing the execute buffers.

IDirect3DTexture

Used to interface to the DirectDrawSurface object. This object is used to provide a texture handle, which is used in materials and the execute and z buffer for a viewport. This object is also used to load an unload textures and handle changes in palettes.

The different aspects that can be changed using this object are:

Texture Wrapping
- used to decide the type of texture wrapping used, namely flat, cylindrical, spherical, or chrome. This is done using the D3DRENDERSTATE_WRAPU and D3DRENDERSTATE_WRAPV render states
Texture Filtering
- used to decide the type of filtering applied to the texture. This is done by using the D3DRENDERSTATE_TEXTUREMAG and D3DRENDERSTATE_MIN render states
Texture Blending
- used to decide how the colours of the texture and the surface are combined. This is done using the D3DRENDERSTATE_TEXTUREMAPBLEND render state
Transparency and Translucency
- used to decide the transparent or translucent appearance of the texture. This is done using the D3DRENDERSTATE_BLENDENABLE render state

IDirect3DMaterial

Used to control the material properties of an object. It contains the colour and possibly a texture handle. The material handle can be used inside the execute buffers or can be used to set the background of a viewport.

IDirect3DLight

Used to create and manipulate light sources and their properties.

IDirect3DViewport

Used to represent the region on which the scene is rendered.

IDirect3DExecuteBuffer

Used to store the execute buffer information, namely the data and the instructions for the execute buffer. The execute buffer is filled with two arrays, one being the vertex list and the other being the opcodes and their data elements. The opcode array follows the vertex array.

Sample Images

In this section, we present some sample screens, of a few immediate mode applications, in figure 20.

sphere
Figure 20: Sample Image

For more details about the immediate mode, refer [2], [3], [1], [9].



Next : DrawPrimitive