The following diagram conceptually shows the main functional blocks
of the NuGraf library and how it is linked in with the host application program.
Figure 2: Basic Connectivity Between the
NuGraf Library and the Host Application
The host program communicates with the library using
the NuGraf 'C' interface; this is a carefully defined set of 'C' language function calls
and parameters that allow data to be passed into or inquired from the NuGraf hierarchical
database. The database maintains all geometric data, its hierarchical structure, lights,
cameras, materials and textures, among other attributes.
When the rendering process begins the database manager parcels out the appropriate data to
the internal rendering module which converts the raw geometric data into a photo-realistic
image. Integral to the renderer are the shader and texture libraries which provide such
varied functions as 2D image and 3D procedural texture mapping, various forms of
environment mapping, shadow generation and the simulation of different surface materials.
The rendered image is output one scanline of pixels at a time. The data is handled either
by internal output drivers or by custom output drivers defined by the host program. The
NuGraf toolkit provides a number of predefined output drivers such as BMP, GIF, JPEG, PPM,
TARGA and TIFF file drivers, and VGA, Microsoft Windows, GL and X11 frame buffer drivers.
As part of an integration process three custom I/O drivers are typically written which
interface between the library and the host application:
The Custom Error Handler receives informational,
error and fatal error messages from the renderer and acts upon them accordingly.
The Custom Interrupt Handler is called once per
scanline and performs two functions. First, it receives status information from the
renderer which indicates how much of the image has been rendered; this information can be
displayed for immediate user feedback. Second, the status returned from the handler to the
renderer can be used to prematurely abort the rendering process; this allows for a quick
and easy method for the user to abort the renderer.
The Custom Output Driver receives raw scanline data
from the renderer and displays it on the desired output device. The NuGraf library has an
extensive sub-library of routines which allow developers to quickly write 8-bit or 24-bit
custom output drivers.