Steps to Create an Application
After the introduction to immediate mode and the concept of execute buffers, let us look at the steps needed to create an application using the immediate mode.
To create an immediate mode application, we need to create the DirectDraw and Direct3D objects required for rendering. After creating the objects, we need to set the render state. After setting the render state, we need to create the execute buffers and fill them with the appropriate data and instructions. To render the data, we need to execute the execute buffers. On executing the execute buffers, the data is taken by the rendering engine and processed, the results of which are displayed.
The steps, required to be folowed to create an immeidate mode application are shown below:
- Declare the variables required to store the different values and objects of the application. The variables typically store pointers to a DirectDraw object, a Direct3D object, the execute buffers, etc
- Initialize Windows, to create the Window on which the data is to be rendered
- Create the DirectDraw and the Direct3D objects, required for rendering
- Select an appropriate device
- After selecting the device, create and initialize the viewport and its parameters
- Set the render state of the application
- Setup the execute buffers. Prepare the execute buffers and fill them with the appropriate data
- After initializing the execute buffers, display the window and then go into an infinite loop, waiting for events to happen. When events are received, they are processed by the window event handler if they are Windows events. If there are no events to be processed, we need to render the next frame. This is done by executing the execute buffers created in a previous step
|