GL Package

jahuwaldt.gl

This library is provided as free software under the terms of the Library General Public License.

I have written a Java class package for working with 3D graphics and OpenGL/GL4Java in particular. This package currently consists of the following classes:

- GLTools: A generic collection of small static methods for
working with 3D graphics. These methods are not OpenGL specific,
but are geared towards working with OpenGL. Currently, this class
contains methods that do the following: normalize a 3D vector,
calculate the cross product and dot product of two vectors,
calculate the normal vector of a triangle surface, calculate 2D
and 3D distance, calculate 2D and 3D approximate distance (fast!),
calculate a fast fixed-point approximation for the arctangent, and
fast table-lookup versions of sine and cosine.

- GLUtils: A collection of small utility methods for rendering
simple shapes in OpenGL using GL4Java. Includes methods for
efficiently rendering 2D circles, 2D inclined ellipses, and 2D
inclined elliptical arcs.

- Matrix: A class of small static methods for working with
transformation matrices. You should avoid working with
transformation matrices in Java if you can (poor floating point
performance), but if you must, then use these efficient methods.
This class includes methods for the following: convert radians to
degrees and vice-versa, load the identity matrix, set X, Y, &
Z axis rotation matrices, set a scale matrix, set a translate
matrix, matrix multiplication, post-concatenation (fast!) X,Y,
& Z rotation, scale, and transformation matrix
multiplication.

- VirtualSphere: A class that implements the virtual sphere
algorithm for using a mouse to manipulate a 3D model or scene.
Works by setting up an imaginary unit sphere in the window port
where the rotation angle depends on the position of the mouse on
the virtual sphere. This gives a
**much**more intuitive user interface that simply changing the X and Y rotation angles linearly with mouse movement.

If you download my GL package and use it. Let me know what you think and especially let me know if there is something that should be corrected or added to this package.

My GL package can be downloaded by clicking here:
**jahuwaldt.gl** (20k), Version: May
13, 2002.

Version history .

Need help?

Created: January 31, 2001

Modified: June 11, 2002