libdms

The libdms library consists of four general sections:

Miscellaneous useful functions

These are:

dms::checkGLError(char *prefix)
Prints any existing OpenGL error, labelled by the string prefix
dms::drawString(char *string)
dms::drawString(char *string,Vector3 position)
dms::drawString(char *string,Vector2 position)
Draws the given string, at the 2D or 3D location position. An optional final argument is the GLUT font to use; the default font is GLUT_BITMAP_TIMES_ROMAN_24.
dms::currentTime()
Returns the current time, in (floating-point) seconds. The return value is 0 the first time this function is called.
dms::beginFrame()
Tells libdms to record the current time, for use by frameTime() and deltaTime()
dms::frameTime()
Returns the time, in seconds, when the current frame began.
dms::deltaTime()
Returns the number of seconds between the beginning of the previous frame and the beginning of the current frame.
dms::computeNormal(GLfloat *v0, GLfloat *v1, GLfloat *v2, GLfloat *normal)
dms::computeNormal(Vector3 v0, Vector3 v1, Vector3 v2, Vector3& normal)
Computes the normal vector for a triangle (or polygon) with the vertex positions v0, v1, and v2.
dms::degreesToRadians(GLfloat angle)
Converts an angle from degrees to radians.
dms::radiansToDegrees(GLfloat angle)
Converts an angle from radians to degrees.

Vector classes

These are the classes Vector2, Vector3, and Vector4, representing 2, 3, and 4 dimensional points or vectors. The classes include several standard functions such as dot products, lengths, and math functions (addition, etc.).

The classes can be used for computations of object motions and geometry. They are also used by most of the other classes.

The Color class is a subclass of Vector4 that includes a function for calling glColor, and several predefined constant names for standard colors - Color::Red, Color::Green, etc.

Basic OpenGL "wrapper" classes

These classes - Light, Material, Texture2D, Transparency, and SimpleTransform - wrap various bits of fairly common OpenGL calls. Each class includes member variables to store the data required for the feature they implement (e.g. ambient/diffuse/specular color), and functions to set and get the values of these member variables.

There are also Image and TIFFImage classes for storing the data used by textures.

Higher level classes

These are the Camera and Object abstract classes, and their derived classes.

Camera represents a view of a scene. It consists of a projection (perspective or orthographic), and a camera position and orientation. There are two subclasses, for the different kinds of projection - PerspCamera and OrthoCamera. The base Camera class itself takes care of the position & orientation, stored as an X/Y/Z location and rotations about the Y and X axes.



next