>
In order to use jogl for the course, you will need to have a copy of jogl.jar and you will need the native jogl-openGL library binding files for the platform you are using. For windows, the required files are in jogl-natives-win32.jar, and for linux the equivalent is jogl-natives-linux.jar. You can download these files to your own machine, or if you want to use jogl on the lab machines, the files are already installed /p/lib.
To use the lab machines, you will need to make sure that your LD_LIBRARY_PATH environment variable includes /p/lib and that your CLASSPATH environment variable contains /p/lib/jogl.jar. Java classpaths are notoriously tricky, you'll need to be careful in setting yours. For instance, make certain that your classpath also contains "." for the current directory so that the java compiler and runtime can find files you are using the your current directory. A minimal classpath will look something like ".:/p/lib" for this class.
To use your own machine, make sure you have already installed a Java 2SE SDK, and set your PATH to include the bin directory for that installation so that you will be able to execute java and javac on the command line.
To use your own linux machine, just uncompress the jogl-native-linux.jar file into a directory where you will want to keep the libraries for binding to openGL. This can be done using the command "jar xvf jogl-native-linux.jar" in the directory where you have put the jar file. You can use whatever directory you like, but add that directory to your LD_LIBRARY_PATH. You should likewise copy jogl.jar to a directory that you will then add to your CLASSPATH (remember to name not just the directory, but directory/jogl.jar in the classpath, and be sure to precede it with ".").
For a windows machine, you will do just as you do for the linux machine, except the native files are in jogl-native-win32.jar. If you are using cygwin under windows, add the directory for the uncompressed native libraries to your LD_LIBRARY_PATH. If you are using java under native windows, add this directory to your PATH environment variable.
Note that if you are using an IDE such as Eclipse or BlueJ, you will also need to tell the IDE program to include jogl.jar in the build path. The exact mechanism for doing this varies from IDE to IDE. In BlueJ you can do this by selecting the libraries tab in the preferences dialog and adding the path to jogl.jar (just as you added it to the CLASSPATH). In Eclipse, select Project, then Properties, then the Libraries tab under Java Build Path, and select the Add External Jar button to add this path.
Once you have the system configured, you should try to compile and run
one of the demo programs, say Gears. These demos are precompiled in
the jar files, so you can try just executing the demo without
compiling if you like. For example, you could cd to a directory
containing all of the jar files (the one containing the native
libraries need not be there), and then executing a command like the
following from the command line:
java -cp jogl-demos.jar:jogl-demos-data.jar:jogl-demos-util.jar:jogl-jar demos.jgears.JGears
Note that if you are in windows, you should replace the colons with
semicolons in the above statement. If things are set up right, you
should see a window with some colorful gears turning in it. If you are
not in the directory containing the jar files when you execute this
command, you can simple put the full pathname to each of the jar files in
place of the jar file names in the path and it should work.
If this has been successful, you should then try to compile source
code from the demos, which you can get
here. Unzip this into a working
directory. If you have set up your environment variables with the
paths to jogl.jar and the native libraries then you should cd to
jogl-demos/src from your working directory (reverse the / in windows,
of course). Now you should be able to execute:
javac demos/jgears/JGears.java
(Again, reverse the slashes in Windows.) If this returns normally,
you've compiled the demo. To execute it, issue the command:
java demos.jgears.JGears
You should once again see the colorful gears turning.
If you are planning to use Java and jogl in the course, note that you will not be using Glut with this system. Instead, jogl is nicely integrated with the Java Abstact Windowing Toolkit (java.awt.*) and Swing (javax.swing.*). These form a much more powerful windowing toolkit than GLUT, but of course with power comes complexity. If you are not already familiar with these, I would recommend getting a good reference book on Swing, or looking here for a tutorial online, and then looking carefully through the source code of some of the demos like JGears. The textbook does not cover this interface, nor will we have time in class to discuss it much, so beware the learning curve if you aren't already familiar with Swing and/or AWT.
To make getting started with this easier, I've translated the gasket3.c code more or less directly into java. You can download it here. Run this similarly to the Gears demo, except in this case there is no package an no other files needed, so you can simply compile and execute it from the directory in which you put it (assuming you are set up to use jogl as above).
As always with java, you will need javadoc at your fingertips to use jogl. The user's guide will likely be helpful, especially in getting started. For more information on the ins and outs of installing and running jogl, and for an alternate, and always up to date, source of jogl code, see the jogl home page.