A 3D Graphics Library

These pages describe the main features of a 3D graphics library. The library uses OpenGL as a rendering engine, but builds facilities on top of this supporting data structures for faces and objects, and also for viewing.

The library is implemented in C, though it may be used with C++. This situation is realistic, since out in the world so far, the majority of such graphics libraries are organised in this way.

Although the library is written in C, it closely follows an object oriented methodology (though without inheritance). Each concept of graphics is represented as a (set of) structures, declared in a .h file, and there is a corresponding .c file with the implementation. The first parameter of every function is always the object (ie, structure) to which the function applies - hence the function may be thought of as a method, to be applied to the object of the appropriate type. The only exception to this rule, is when a new instance of the type is created.

For example, there is the concept of a 3D point, represented by the Point3D structure (point.h), and the function newPoint3D(double x, double y, double z) returns an instance of a Point3D representing the point (x,y,z). Then there is, eg, a function transformPoint3D(Point3D *p, Matrix m) which applies the 4*4 Matrix M, to the point. (Obviously, there is another type of object called Matrix - represented in matrix.h and matrix.c).

The library may be used to import VRML1.0 files, and also a 'native' very simplistic file format for representing an object. Each such file (VRML1.0 or native) represents a single object, and a scene may be composed - an object hierarchy can be built - from a collection of such objects. A VRML1.0 normally encodes such an object hierarchy (although the entire hierarchy may represent one object such as a model of a person).

Where is it?

The files can be found in the directory ~ucacmsl/Public/CG/Lib3D1.0

What's there?

Using it with VRML

To use the system with VRML an additional library is needed. This is called libdvrml.a which is located as referenced in the Makefile.

You must set the following environment variable:

DVRML_PATH

to point to where the VRML files are that you want to use. You will find a source of VRML files in /cs/research/vr/starship/vr/vrml/.

For example, if you wanted to access the VRML files representing 'people' you must do the following in the Unix shell:

setenv DVRML_PATH /cs/research/vr/starship/vr/vrml/people

and then run the program by typing (eg)

vrml shrmwak2.wrl

Note that the VRML files end with .wrl


The Library

The software is described in a number of modules, each representing a graphics concept.