Java OpenGL

From Infogalactic: the planetary knowledge core
Jump to: navigation, search
JOGL (JSR-231)
200px
A demo screenshot illustrating real-time refraction using JOGL on Mac OS X
Developer(s) JogAmp Community
Stable release 2.3.2 / October 10, 2015; 8 years ago (2015-10-10)
Preview release 2.3.2 / October 10, 2015; 8 years ago (2015-10-10)
Written in Java, C
Operating system Cross-platform
Type 3D computer graphics software (library/API)
License BSD license
Website jogamp.org

Java OpenGL (JOGL) is a wrapper library that allows OpenGL to be used in the Java programming language.[1][2] It was originally developed by Kenneth Bradley Russell and Christopher John Kline, and was further developed by the Sun Microsystems Game Technology Group. Since 2010, it has been an independent open source project under a BSD license. It is the reference implementation for Java Bindings for OpenGL (JSR-231).

JOGL allows access to most OpenGL features available to C language programs through the use of Java Native Interface (JNI). It offers access to both the standard GL* functions along with the GLU* functions; however the OpenGL Utility Toolkit (GLUT) library is not available for window-system related calls, as Java has its own windowing systems: Abstract Window Toolkit (AWT), Swing, and some extensions.

Design

The base OpenGL C API, as well as its associated Windowing API,[3] are accessed in JOGL via Java Native Interface (JNI) calls. As such, the underlying system must support OpenGL for JOGL to work.

JOGL differs from some other Java OpenGL wrapper libraries in that it merely exposes the procedural OpenGL API via methods on a few classes, rather than trying to map OpenGL functionality onto the object-oriented programming paradigm. Indeed, most of the JOGL code is autogenerated from the OpenGL C header files via a conversion tool named GlueGen, which was programmed specifically to facilitate the creation of JOGL.

This design decision has both its advantages and disadvantages. The procedural and state machine nature of OpenGL is inconsistent with the typical method of programming under Java, which is bothersome to many programmers. However, the straightforward mapping of the OpenGL C API to Java methods makes conversion of existing C applications and example code much simpler. The thin layer of abstraction provided by JOGL makes runtime execution quite efficient, but accordingly is more difficult to code compared to higher-level abstraction libraries like Java3D. Because most of the code is autogenerated, changes to OpenGL can be rapidly added to JOGL.

Status and standardization

As of 2015, JOGL provides full access to the OpenGL 4.5 specification as well as almost all vendor extensions (and OpenCL, OpenMAX and OpenAL).[4] The 1.1.0 version is the reference implementation for JSR-231 (Java Bindings for OpenGL).[5] The 1.1.1 release gave limited access to GLU NURBS, providing rendering of curved lines and surfaces via the traditional GLU APIs. The 2.3.2 release added support for OpenGL versions up to 4.5, and OpenGL ES versions up to 3.2.

Wayland support is planned.[6]

Java2D-OpenGL interoperability

Since the Java SE 6 version of the Java language, Java2D (the API for drawing two dimensional graphics in Java) and JOGL have become interoperable, allowing it to :

  • Overlay Swing components (lightweight menus, tooltips, and other widgets) on top of OpenGL rendering.[7]
  • Draw 3D OpenGL graphics on top of Java2D rendering (see here for a button with an OpenGL icon).
  • Use 3D graphics anywhere where ordinarily a Swing widget would be used. (Inside a JTable, JTree, ...)
  • Draw Java2D graphics on top of 3D OpenGL rendering.

Codes examples

This program displays a simple 3D rendering of a polygon using JOGL. Please note though that this code is a demonstration of the use of JOGL and as such makes use of immediate mode drawing commands; this serves to show how the conventional C style API is used through JOGL, but it is strongly recommended to make use of modern OpenGL techniques (like in this much more complicated example).

See also

  • Java Bindings for OpenGL, The Java Community Specification Request for which JOGL provides an implementation
  • Ardor3D, a high performance, professionally oriented scene graph using several bindings for OpenGL and OpenGL-ES including JOGL
  • Elflight Engine, a high performance 3D game engine optimised for the web
  • JMonkey Engine, a high performance scene graph based graphics API using several bindings for OpenGL and OpenGL-ES including JOGL
  • Poxnora, an online multiplayer game using JOGL
  • RuneScape, a MMORPG using JOGL
  • Jake2, a Java port of Quake II using several bindings for OpenGL including JOGL for its low-level graphic API
  • Scilab, a numerical computing program using JOGL for 2D, 3D rendering
  • Jreality, a mathematical visualization package
  • ClearVolume, a JOGL powered real-time live 3D visualization library designed for high-end volumetric light sheet microscopes.
  • LWJGL, an alternative open-source OpenGL wrapper library

References

  1. Lua error in package.lua at line 80: module 'strict' not found.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. http://jogamp.org/jogl/www/
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. Lua error in package.lua at line 80: module 'strict' not found.
  7. http://jogamp.org/jogl/doc/userguide/#overview

External links