Instructional Lab
The instructional lab machines (iLab) are Linux workstations in Hill 248, 250, 252 and 254.
If you are not familiar with Linux, here is a nice tutorial that covers the basics.
The 3D graphics hardware in this machines allows OpenGL programs use this hardware to run nice and fast. We'll also be using some of the programmable features of the graphics hardware later in the semester. Not all machines have the same graphics cards, so you might notice different behavior across the labs.
To activate or create a account on these machiens, follow the instructions on:
https://www.cs.rutgers.edu/resources/systems/ilab/newaccount
to activate your account.
Please do this as soon as possible, and let us know if you have
questions or difficulties.
Use your Rutgers ID to access the rooms in that hallway. The exterior door to Hill by the courtyard (under the 2nd floor bridge) has a card reader so that the lab is always accessible. Let me know if you find otherwise (even if sporadic).
These labs are also used by other students; typically Computer Science graduate students. Some undergradate courses use these labs as well, and on some occasions there will be exams run for 100-level CS courses (in which case one or two of the rooms are closed).
If you go over your disk quota on the iLab filesystem (use the "quota" command to check), just send mail to help@cs.rutgers.edu. Note that if you are over your limit, you will need to do a "failsafe" login to use the machine on console (look for this option on the login window).
Software
Note: You must be logged in "on console" (sitting in front of the actual machine) to display OpenGL windows. You won't be able to display these windows remotely from X terminals (you can of course, edit and compile remotely). So your only choices for running the assignment are going to the lab, or getting this set up on your own machine (see below).
The software for the projects in this class is on the iLab machines. We will be using Java 1.6 for our assignments; this version of Java supports OpenGL well (versions 1.4 and earlier do not, and often exhibit strange behavior).
Setting up
You will need to set up your account a little bit. In short, all you need to do is add the following line to your .cshrc file (or create one if you don't have one):
source ~decarlo/428/setup(You will also need to type this line in your shell for just the first time you do this---for each window separately; next time you log in, it will be done automatically, since you added it to your .cshrc. Or instead of typing this command in your shell, simply log out and log back in.) If your default shell is bash, then you need to run the bash version of this script. (You will get syntax errors if you run the above csh version. Type "ps -p $$" on the command line to see which shell you're running.) If you're using bash, then add the following to your .bashrc or .bash_profile:
source ~decarlo/428/setup-bash
(We might need to change the script during the semester, so please source the original script instead of copying it.)
Compiling and Running
Once you set up the above, compiling and running an OpenGL Java program is the same as any other Java program (where you use "javac" to compile, and "java" to run). You'll be given a makefile for each assignment, so you'll just need to type "make" to compile your assignment.
Sample program
There is a sample program in ~decarlo/428/example on the iLab machines. To compile and run it, just copy all of the files in that directory to a directory of your own, and then type "make". This compiles it (by running javac). Then you run it by typing: "java Example". A window should appear which contains a spinning white rectangle.
To hand in, you first need to know which files you should be handing in. The web page for the assignment will be specific about this. Let's say for the following examples that you need to hand in the file stuff.java. From the web interface, select the assignment you are handing in. Note that here, you can only hand in a single file. In this case, you simply specify the file path to stuff.java.
If the assignment calls for you to hand in multiple files, you need to create a TAR or ZIP file that contains all of your project files. To create a TAR file (on the linux machines), which contains the files one.java and two.java, you do the following:
tar cf handin.tar one.java two.java
and then you simply select the file handin.tar in your browser.
If you have any problems with the hand-in process, please email us.
In order to get the 428 programs running on your own machine, you'll need Java 1.5 or later, and two things:
wget http://download.java.net/media/jogl/builds/archive/jsr-231-1.1.1/jogl-1.1.1-XXX.zip unzip -j jogl*.zip "jogl-*/lib/*" -d lib wget http://mirrors.ibiblio.org/pub/mirrors/maven/java3d/jars/vecmath-1.3.1.jar -O lib/vecmath.jar(Some people prefer to keep the jar and binaries separate; feel free to do this if you like, and adjust what follows.) Configuring your system
Now you need to tell Java where the jar files are (for compilation and runtime), and your system where the libraries/binaries are (for runtime). The binaries will have file extensions that vary based on the system type: .dll in Windows, .so in Linux, .jnilib in Mac OS, etc.
From here you can take two routes. One possibility is to install these files in standard locations so that your system will find them automatically. What to do varies a lot based on exactly how your software is installed, so only try this if you know what you are doing. (One reasonable description seems to be here; follow step 2, although be sure to install all files, including the gluegen files and vecmath.jar, and not just those for JOGL). The iLab is set up this way for JOGL, and only the vecmath JAR file is specified using a script. The second choice (which is recommended) is to set the CLASSPATH variable so that it contains all of the jar files (not just the directory), and your library path variable includes the directory that contains the binaries. The libary path variable name depends on your system type: PATH in Windows, LD_LIBARY_PATH in Linux, DYLD_LIBRARY_PATH in Mac OS, etc. You can set these variables once (i.e. somewhere in the system settings in Windows, which varies on the version of windows you're using), or do it by sourcing a script as in the iLab. You'll need to run this script at the start of each session when working on 428, or you can simply add it to whatever is run when you log in (i.e. your .cshrc). Here is a csh/tcsh script that works for Mac OS (set the PATH428 variable inside the script based on where you have installed things). Save this in a text file called setup and either type source setup every session you work on 428, or add it to your .cshrc. A Linux version will be essentially the same, except the library path variable name on the last line must change to LD_LIBRARY_PATH: # CS 428 setup script for Mac OS: csh version
if ($?TERM == 1) then
echo "Setting up for CS 428"
endif
# $PATH428/lib is the directory that contains the JOGL, gluegen and vecmath jars and JNI binaries
setenv PATH428 ~/jogl
# Append stuff to the java class path, keeping what's already there
if ( $?CLASSPATH ) then
set TMP_CP = "${CLASSPATH}:."
else
set TMP_CP = "."
endif
setenv CLASSPATH ${TMP_CP}:${PATH428}/lib/vecmath.jar:${PATH428}/lib/jogl.jar:${PATH428}/lib/gluegen-rt.jar
setenv DYLD_LIBRARY_PATH ${PATH428}/lib
# CS 428 setup script for Mac OS: bash version
if [ -n "${TERM}" ] ; then
echo "Setting up for CS 428"
fi
# $PATH428/lib is the directory that contains the JOGL and gluegen jars and JNI binaries
PATH428=~/jogl
# Append stuff to the java class path, keeping what's already there
if [ -n "${CLASSPATH}" ] ; then
TMP_CP="${CLASSPATH}:."
else
TMP_CP="."
fi
CLASSPATH=${TMP_CP}:${PATH428}/lib/vecmath.jar:${PATH428}/lib/jogl.jar:${PATH428}/lib/gluegen-rt.jar
export CLASSPATH
DYLD_LIBRARY_PATH=${PATH428}/lib
export DYLD_LIBRARY_PATH
A quick guide if you encounter errors:
If you are using an IDE like eclipse or netbeans, you'll need to tell it about the jar files you are using. It's pretty much the same in every program. (In eclipse, in the "Java Settings" dialog, in the "Libaries" tab, click the button "Add external JARs", and add the three jar files (jogl, gluegen, vecmath). You will still need to set up your library path variable as above, so the binaries are properly located.
In the iLab, you just need to add the vecmath jar file, which is located at /ilab/users/decarlo/428/lib/vecmath.jar. However, you must set the Java SDK to use the installed 1.6gl version. (Note: this has not been tested!)