Scene ManagementThe 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:
|
|||||||||||