Peter Mileff PhD Programming of Graphics

Introduction to JOGL

University of Miskolc Department of Information Technology JOGL Overview

⦿ Java binding for OpenGL (JOGL) is the recent binding for OpenGL graphics API in Java

⦿ It is a wrapper library, which can access OpenGL API ⦿ It is designed to create 2D and 3D graphics applications coded in Java ⦿ JOGL is an open-source library ⦿ JOGL focuses only on 2D and 3D Rendering ● The interfaces dealing with sound and input-output are not included in JOGL ⦿ It includes: ● Graphics Utility Library (GLU), ● GL Utility toolkit (GLUT)

2 Installation

⦿ System Requirements

● JDK version: 1.4 or above ● Video Card that supports at least OpenGL version 1.1

⦿ Configure Environment

● PATH and JAVA_HOME environment variables should be set: ○ PATH: typically java_install_dir/bin

⦿ E.g.: :\Program Files\Java\Jdk1.6.0_21\bin

○ JAVA_HOME: java_install_dir ⦿ E.g.: C:\Program Files\Java\Jdk1.6.0_21

3 Download JOGL http://jogamp.org

4 Download JOGL http://jogamp.org

5 Setup JOGL in Eclipse...

6 Create New Project

7 Create New Project

8 JOGL external libraries

⦿ Create a new folder named lib in the project folder

⦿ Copy the (proper) files into the lib folder: ● Example in case of Linux 64 bit:

○ gluegen-rt-natives-linux-amd64.jar ○ gluegen-rt.jar ○ jogl-all-natives-linux-amd64.jar ○ jogl-all.jar

9 Add libraries to build path

10 Jogl in Eclipse

⦿ To make all .jar files available to other projects ● Go to main menu, select Window > Preferences

⦿ In preferences window: ● in the drop down menu on the left hand side, follow the hierarchy- Java → Build Path → User Libraries. ● Click on “New…” button. ● It opens up a dialog box. Enter the library name. E.g.: JOGL2 ● Add jar files glugen-rt.jar and jogl-all.jar using button “Add External JARs...”.

● It creates a new user library named JOGL2

11 Jogl in Eclipse

⦿ We can start developing OpenGL based applications !

12 13