Date: March 5, 2011Downloads & InstallationTo begin, you need to get the tools that enable you to program in Java and utilize OpenGL. There are three main downloads you will need for these tutorials: 1. JDK (Java Development Kit)This is the set of programs and libraries that allow you to write Java code. You can download the JDK from here. By downloading the JDK you also get a JRE (Java Runtime Environment), which is the collection of libraries required to actually run Java programs. At the time of writing, I am using JDK 6 Update 21 (Java 1.6.0_21) for Linux 64-bit. Follow the installation instructions provided to get the JDK set up for your platform. 2. JOGL (Java Bindings for OpenGL)JOGL provides access to the OpenGL graphics API, enabling hardware-accelerated graphics with Java. JOGL is currently maintained by JogAmp. You can download the most recent signed release of JOGL from here (more info on build versions). You will want to get the file in the format "jogl-2.0-b<version>-<date>-<platform>.7z". The platform indicates amd64 for 64-bit architectures and i586 for 32-bit architectures. For example (as of March 5, 2011), the most recent files by platform are: Linux 64-bit: jogl-2.0-b23-20110303-linux-amd64.7z Linux 32-bit: jogl-2.0-b23-20110303-linux-i586.7z Windows 64-bit: jogl-2.0-b23-20110303-windows-amd64.7z Windows 32-bit: jogl-2.0-b23-20110303-windows-i586.7z Mac OS X: jogl-2.0-b23-20110303-macosx-universal.7z The libraries used to be in .zip files, but are now in 7-zip format. You may need to download a utility to extract these files. Note: Do not be confused by "amd64" if you have a 64-bit Intel processor, as it refers to the instruction set and not the manufacturer of your CPU. You can extract these files to your JDK / JRE installation, but I don't recommend it for portability reasons. It's important to remember that these files are needed by any computer that wants to run a JOGL application. I typically create a lib directory somewhere in my home and extract all my libraries there. For instance, "/home/justin/lib/jogl-2.0" in Linux or 'C:\lib\jogl-2.0" in Windows. There are two important directories for writing applications: jar/ - contains all of the Java bytecode (.class files) for JOGL grouped into .JAR files. lib/ - contains the native libraries (.so for Linux / OS X, .dll for Windows) for your platform. 3. Eclipse IDEAn integrated development environment (IDE) allows you to more efficiently write Java programs. This isn't strictly necessary, and you may choose to use another IDE, but this guide will focus on Eclipse. Download the Eclipse IDE for Java Developers here. After you download Eclipse, you do not need to install it. Simply open the directory you extracted the files to and run eclipse. Setup EclipseAt this point, you're ready to configure Eclipse to make Java applications that utilize the JOGL library. There are a few ways to do this, but I'm going to recommend the one that is most convenient if you decide to create multiple Java projects inside Eclipse. Start Eclipse by navigating to the directory you extracted it and starting "eclipse" (Linux) or "eclipse.exe" (Windows). Eclipse will ask you to select a Workspace, which is the directory that contains your projects as well as your preferences and settings for Eclipse. Enter a directory you can remember and it will create it for you. Creating Project Source FolderFirst we create a project that will contain the source code for each program. This project will go into your workspace directory.
Creating JOGL User LibraryTo use JOGL, it's necessary for your project to reference it. The JOGL library consists of a number of JAR files and native libraries, but it's preferable to refer to this collection as a whole rather than each file separately. To do this, create a "user library" that lists all of the required files.
For now, you only need to be concerned with the native library location for each JAR in the jogl-2.0 user library. For each JAR:
Linking JOGL with ProjectYou're done setting up the JOGL user library, and you should only have to do this once unless you download a newer version of JOGL at some point. Now you simply have to tell your project to use your JOGL user library.
|




