Java 3D

This is the first of the Java 3D lectures. This collection of lectures are about the files in this directory. Prog1.java is the Hello3D.java from the examples subdirectory of java3d. This is in ~bellenot/jdk1.2beta4/java3d/examples/Hello3D. Prog2.java adds a model, and the model code in ColorTetra.class. Prog3,java adds mouse movements, Prog4.java adds lights. and Prog5.java which is not quite working yet adds texture.

We drew pictures in class to see the how the order of rotations works for Prog1.java. In particular, the mul was "pre-multiplication" that is the Y rotation was done first.

We talked a bit about ColorTetra and how the geometry and color worked for this example. It is used in Prog2.java and Prog3.java.


I have translated the old device stuff into Java3D ending up with the new universe stuff. As project 1 built on the the device stuff, project 2 builds on the universe stuff. Eventually the statement for project 2 will appear but it is safe to assume that it will again be drawing surfaces for z = f(x,y,t) for fixed t.

In going from the old device stuff to the new universe stuff several changes occurred. First Point3f replaces Vector3f. The geometry constructors of Java3D wants points instead of vectors, and it is pointless to fight the change. Since this changes things, I changed some of the names. Function3f has its role replaced by Curve3f. ParametricCurve became ParametricCurve3D but TorusKnot and Helix changed without changing the names. (So much for consistency.) The code to draw the axes got put into its own class.

The Device.java driver is gone and in its place is essentially the code for Prog3.java, but called Universe.java. The name universe sounds grander than it is, but it is the name Java3D uses for the root of its scene graph. (Graph as in graph theory, not as in plot of y=f(x).) The creators of Java3D decided the name Universe wasn't grand enough, their java class is called VirtualUniverse, which leaves Universe free for our use.


There are now two versions of the Light code. Prog4.java has the lights fixed, while in Prog4b.java both the lights and the objects move together. The Prog4b.java implements lights like the program Mathematica. We noticed that the back was black, cause there are no lights back there.

The code for Prog5.java and TexTetra.java are now working. I think there are some coding problems, so If I have time I will improve the these modules. In TexTetra.java there is some commented out code which painted the image below onto the tetra.

The reason TexTetra.java took so long was figuring out how to create our own Texture on the fly rather than loading it from a file.