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

 


Scene Management

The concept of a scene and scene management in immediate mode is very different than that in the retained mode. In retained mode, we have the concept that the scene to be rendered, is a hierarchic organization of frames and the frames are used to position and manipulate the objects and the lights.

In immediate mode, a scene is nothing but a collection of all the vertices and the drawing primitives like points, lines and triangles. A scene exists only in the execute buffer instructions and nowhere else. There is no concept of frames, objects and explicit lights.

An important point to be kept in mind while rendering the scene at hand, is that rendering of a scene uses the famous sandwich mechanism used in Windows, for painting a window. Before rendering, the application has to call the BeginScene method of the IDirect3DDevice object. After the rendering is done, the application has to call the EndScene method of the IDirect3DDevice object. Rendering is done between tese two method calls.

Due to BeginScene, the system locks the execute buffer, so that no other thread can modify its contents. On calling EndScene, the lock is released. The application has to take care, not to use multiple BeginScene and EndScene calls in a single frame, as it may affect the performance of the application. If multiple execute buffers have to be used, all the execute buffers can be executed in one single BeginScene, EndScene sequence.

Ownership

A few points concerned with ownership, that should be kept in mind are listed below:

  • Each execute buffer and viewport are owned exactly by one device
  • Each light is owned exactly by one viewport
  • Material and texture object can be associated with more than one device




Next : Sample Application