Next: objects.
Up: Display objects
Previous: Device-Specific Rendering.
DispCmd objects are used by Displayable objects to construct a list of drawing commands (tokens) in a format which can be processed by a DisplayDevice. When rendering an image, a DisplayDevice does not work directory with a Displayable; instead, the DisplayDevice is given a simple byte array into which drawing commands have been assembled. Each Displayable contains one or more of these drawing lists; they are stored by the Scene and processed by the render routine of a DisplayDevice. The DispCmd objects act to put the data into these drawing lists in the proper format for the operation specified. Each DispCmd object appends its data to the current end of a provided drawing list in this format and order:
- Integer code specifying the drawing operation (codes are defined in the file DispCmds.h).
- Integer stating the size of the command, in bytes (not including the code or this size count).
- Data necessary for the drawing command (i.e., XYZ positions of the endpoints of a line or a cylinder).
Why are things done this way? There are a few reasons:
- Speed - Once a compact display list has been created in a single block of memory, that block may be read quickly by the DisplayDevice when drawing the object. Putting it all as a contiguous block helps take advantage of cache memory.
- CAVE access - The CAVE programming paradigm now requires the drawing program to fork into several different processes, including one process for each wall and an ``update'' process. All these processes run on the same computer (a multi-headed SGI, i.e. a tower Onyx) and use shared memory to communicate what to draw between the update process and the drawing processes. Using a list of simple integer codes and copies of the coordinates for drawing lines, triangles, etc. instead of, say, a list of pointers to DispCmd objects helps reduce the amount of shared memory required and simplifies the drawing processes. Drawing in the CAVE then requires only a specialized CaveDisplayDevice and CaveScene to deal with this shared memory requirement (along with a few other CAVE support routines).
Next: objects.
Up: Display objects
Previous: Device-Specific Rendering.
Justin Gullingsrud
Tue Apr 6 09:26:48 CDT 1999