This directory contains tests (mostly taken from various C OpenGL examples) I've used to make sure that my OpenGL bindings are working properly. Currently I don't have anything close to a complete test suite, but I do have tests for the areas I'm worried about.

Concurrence.java

Tests the binding's ability to render in multiple canvases concurrently. You should see two windows, each one like the image on the left. The red sphere will grow and shrink with time, and the axis will rotate. You can exit the demo by closing the window labeled "Thread-1". The geometry is displayed with the GeometryViewer, so you can move through it with the keyboard and mouse.

FeedbackTest.java

Makes sure that feedback mode actually works. It should produce a window containing a line and a dot, and the following output:
GL_LINE_RESET_TOKEN
 117.6001 111.8999 0.0 1.0 1.0 1.0 1.0
 196.0 223.7998 0.0 1.0 1.0 1.0 1.0
GL_LINE_TOKEN
 196.0 223.7998 0.0 1.0 1.0 1.0 1.0
 274.3999 149.2002 0.0 1.0 1.0 1.0 1.0
GL_PASS_THROUGH_TOKEN
1.0
GL_PASS_THROUGH_TOKEN
2.0
GL_POINT_TOKEN
 196.0 186.5 0.0 1.0 1.0 1.0 1.0
42

PlainCube.java

Draws a simple lighted plain cube with a marked axis. The geometry is rendered with a GeometryViewer, so you can move through it with the keyboard and mouse.
NurbsCallback.java
Tests the nurbs callback functions. It doesn't actually draw anything (although it does pop up an empty window) but instead generates a huge amount of output that describes the picture rendered in NurbsSurface.java:
Begin(8)
normal(0.17479114,-0.20703068,0.96259356)
vertex(2.8461537,-2.8695652,-2.971309)
normal(0.3285337,-0.18994243,0.92519593)
vertex(2.8461537,-2.7391305,-2.9438932)
normal(0.15648149,-0.38155743,0.91100353)
vertex(2.6923077,-2.8695652,-2.944128)
normal(0.29775253,-0.35438827,0.88642675)
vertex(2.6923077,-2.7391305,-2.8907397)
normal(0.13688117,-0.5166386,0.8451912)
vertex(2.5384617,-2.8695652,-2.9184573)
...
This example will not work under Linux, because Mesa does not implement the nurbs callback functions.

NurbsSurface.java

This produces a lighted hill with the GLU nurbs functions. The hill is rendered with a GeometryViewer, so you can move through it with the keyboard and mouse.

OpenGLCanvas.java

Demonstrates the ability to embed an OpenGLCanvas in a window with other AWT components. The embedded window is an instance of the Stretch component from Stretch.java.

QuadricError.java

This tests the callback facilities of the GLUQuadric class, and by extension, the callback facilities of the GLUNurbs and GLUTesselator class as well. This is the output it should generate:
Quadric error: 100900

TexturedCube.java

Draws a plain cube, only this time with the OpenGL logo textured mapped to three of the cube's sides. The cube is rendered with a GeometryViewer, so you can move through it with the keyboard and mouse.

TexturedSphere.java

This displays a rotating sphere that has a texture map on it. Everything is rendered with a GeometryViewer, so you can move through it with the keyboard and mouse.

VertexPointer.java

Uses the vertex pointer routines to draw an unlighted cube with different colors on each face. The cube is rendered with a GeometryViewer, so you can move through it with the keyboard and mouse.
 

Most of the demos use the GeometryViewer, which allows you to navigate through the rendered geometry. Dragging the mouse will drag your view along with it, and the keys are set up as follows:

A
move forward
Z
move backward
.
rotate around the Z axis
/
rotate around the Z axis
Q
do an orbit view (rotate around a point in front of you).
E
do an orbit view, in the opposite direction.
I
display information about the OpenGL library being used.
W
write out an uncompressed TGA image of the screen to the supplied filename.
Up arrow
rotate up
Down arrow
rotate down
Left arrow
rotate to the left
Right arrow
rotate to the right
+
zoom out
-
zoom in

If you want to run the tests, and have the Java Run Time Environment installed, you need to use a command line something like this:

jre -cp .;.. PlainCube

The command with old versions of Java installed (in C:\jdk1.1.4 for this example) is a little bit more complicated, because you have to append the base Java libraries to the command path too:

java -classpath .;..;C:\jdk1.1.4\lib\classes.zip TexturedCube

If you have a later version of Java installed (in C:\jdk1.3 for this example) it's as easy as the jre example:

java -cp .;.. Concurrence


Last Changed June 10th, 2001.