Setting Up the Virtual Environment

After the InitApp function has created the window, enumerated the Direct3D drivers, created the Retained-Mode API, created the scene and camera frames, created a DirectDrawClipper object, and created the Direct3D device and viewport, it calls a locally defined BuildScene function to build the scene. Each of the Direct3D samples in this SDK includes its own BuildScene function. These implementations of BuildScene vary depending on the capabilities being demonstrated by the sample.

This section discusses the simplest implementation of BuildScene in this SDK: the version in Egg.c. In this module, BuildScene performs the following tasks:

·Sets up the lights. This is described in the Setting Up the Lights section.

·Adds a mesh to the scene and sets up the position, rotation, and orientation of its frame. This is described in the Loading and Adding a Mesh section.

·Releases the objects that it has created. This is described in the Releasing the Direct3DRM Objects section.

·Overrides several of the default settings from Rmmain.cpp. This is described in the OverrideDefaults and ReadMouse section.