”;
This chapter introduces OpenGL, its functions, the OpenGL bindings in java (GL4java, LWJGL, JOGL), and the advantages of JOGL over other OpenGL bindings.
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, and it is designed to create 2D and 3D graphics applications coded in Java. JOGL is an open-source library initially developed by former MIT graduate students Ken Russell and Chris Kline. Later, it was adopted by the gaming group at Sun Microsystems, and now it is maintained by Java on Graphics Audio and Processing (JOGAMP). JOGL functions on various operating systems such as Windows, Solaris, Mac OS X, and Linux (on x86).
What is OpenGL?
OpenGL stands for Open Graphics Library, which is a collection of commands to create 2D and 3D graphics. With OpenGL, you can create complicated 3D shapes using very basic primitives such as points, lines, polygons, bitmaps, and images.
Here are a few features of OpenGL −
-
It can work on multiple platforms.
-
It has bindings in several languages such as C++, Python, etc
-
It can render 2D and 3D vector graphics.
-
It interacts with Graphical Processing Unit (GPU) for achieving speedy and
high quality rendering. Rendering is the process of creating an image from a 2D or 3D model. -
It is an industry standard API for writing 3D Graphics applications. For example, games, screensavers, etc.
-
It contains around 150 commands, which programmers can use to specify objects and operations to develop applications.
-
It contains OpenGL Utility Library (GLU) that provides various modeling features, such as quadric surfaces and NURBS curves. GLU is a standard component of OpenGL.
-
The design of OpenGL is focused on efficiency, effectiveness, and its implementation on multiple platforms using multiple languages. To maintain simplicity of an OpenGL API, windowing tasks are not included.
Therefore, OpenGL depends on other programming languages for windowing tasks.
Java Binding for OpenGL API
It is a Java Specification Request (JSR) API specification, which allows to use
OpenGL on Java platform.
Specifications | Details |
---|---|
JSR 231 | This Java binding package supports Java SE platform. |
JSR 239 | This Java binding package supports Java ME platform. |
There are various OpenGL bindings in Java. They are discussed below
GL4java
It is known as OpenGL for Java technology. It has links to OpenGL 1.3 and to nearly all vendor extensions. Also, it can be used with Abstract Window Toolkit (AWT) and Swings. It is a game focused OpenGL binding, which is a single window that displays full screen applications.
LWJGL
-
Light Weight Java Game Library (LWJGL), uses OpenGL 1.5 and works with latest version of java.
-
It can use full screen capabilities of JSE 1.4. It has limited support for AWT/ Swings.
-
It is suitable for lightweight devices such as mobile phones, embedded devices, etc.
JOGL
-
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), and its own API – Native Windowing Toolkit (NEWT).
Why JOGL?
-
It provides full access to the OpenGL APIs (version 1.0, 4.3, ES 1, ES 2 and
ES 3) as well as nearly all the vendor extensions. Hence, all the features in OpenGL are included in JOGL. -
JOGL integrates with the AWT, Swing, and Standard Widget Toolkit (SWT).
It also includes its own Native Windowing Toolkit (NEWT). Hence, it provides
complete support for windowing.
History of JOGL
-
1992 − Silicon Graphics Inc. released the first OpenGL specification.
-
2003 − Java.net website was launched with new features and JOGL was published for the first time on the same website.
-
2010 − Since year 2010, it has been independent open source project under BSD license, which is a liberal license for computer software.
”;