next up previous contents
Next: Colors. Up: Display objects Previous: objects.

The .

Since it has been discussed quite a bit already, it is somewhat obvious at this point that Scene objects are used to maintain a database on what should be drawn to a user-specified DisplayDevice. A Scene contains routines for applying transformation such as rotate, scale, etc. to all the (non-fixed) Displayable objects which have registered with it, and contains routines to manage the memory used for display lists. Each Scene contains actually two categories of lists of items, and in each category there are two lists, one for 2D objects and one for 3D objects. These two types of lists are:

  1. Pointers to all the Displayable objects which have registered with the Scene.
  2. Pointers to the beginning of each display list (essentially treated as arrays of chars). There may be more of these lists than there are registered Displayable objects, since each Displayable (regardless of whether it is a parent, child, or both) provides the Scene object with a copy of the pointer to its display list.

A Scene is the object primarily responsible for collecting all the objects that are to be drawn and for giving these objects to a DisplayDevice for rendering. This is done as follows:

  1. The routine scene->prepare(DisplayDevice *) is called by the user. The Scene will call a routine for each registered Displayable that allows the object to prepare to be drawn. This preparation may include, for example, changing which frame in an animation should be shown, or updating the current position of a 3D pointer, or most anything else that needs to be done each time the Scene is drawn.
  2. The routine scene->draw(DisplayDevice *) is called by the user. This routine proceeds in the following steps:
    1. Prepare the DisplayDevice for drawing 3D objects.
    2. For each 3D display list stored by the Scene, call the routine display->render(void *) with the pointer to the display list.
    3. If stereo is being used, repeat the following step for the other eye.
    4. Prepare the DisplayDevice for drawing 2D objects.
    5. For each 2D display list stored by the Scene, call the routine display->render(void *) with the pointer to the display list.
    6. Update the DisplayDevice after all drawing is complete.

As shown in figure 5.2, there are many classes derived from Displayable, and actually in fact from Displayable3D. Global Displayable objects of note are LightList, which contains a list of Light objects; Axes, which displays a set of XYZ axes in a corner of the display; Stage, which displays a checkerboard panel to one side of the objects in the Scene; VMDTitle, which displays the VMD title credits and rotating letteres; and ColorList, which is described next. The Light objects each represent one light used to illuminate the objects in a Scene which have defined material characteristics for their surfaces.


next up previous contents
Next: Colors. Up: Display objects Previous: objects.

Justin Gullingsrud
Tue Apr 6 09:26:48 CDT 1999