Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

Adding Objects
[Tutorial 1 - Loading a Simple Model]

Loading an Object

Next we will modify the Tutorial1 code to load a simple cube object from disk and display it. This is standard code that opens a stream and reads a clump from the stream. You may have seen similar code in many of the RenderWare Graphics examples.

Destroying the Object

The application caused the clump to be loaded and displayed. It is also the responsibility of the application to destroy the clump when the application terminates. The skeleton generates an rsRWTERMINATE event on shut-down. Our main.c calls the Terminate3D() function, and it is here that we can add code to destroy any clumps that the application creates. Because there is nothing in the application to prevent the user creating 2 or 200 clumps by pressing the F1 key multiple times, it is sensible to use a RenderWare Graphics iteration function to visit all clumps that are in the world and destroy them one at a time. To do this we will create a callback function that destroys a clump, and arrange for this callback to be called once for each clump in the world.

Next...
Criterion Software © 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:46:57 2004. Send Feedback