- Java OpenGL
Infobox_Software
name = JOGL (JSR-231)
caption = A demo screenshot illustrating real-timerefraction using JOGL onMac OS X
developer =Sun Microsystems Game Technology Group
latest_release_version = 1.1.1
latest_release_date =May 22 ,2008
latest_preview_version =
latest_preview_date =
operating_system =Cross-platform
genre =3D computer graphics software (library/API)
license =BSD license
website = [http://jogl.dev.java.net/ jogl.dev.java.net]Java OpenGL (JOGL) is a wrapper library that allows
OpenGL to be used in the Java programming language. It is currently being developed by the Game Technology Group atSun Microsystems , and is the reference implementation for JSR-231 (Java Bindings for OpenGL).JOGL allows access to most features available to C programming language programmers, with the notable exception of window-system related calls in GLUT (as Java contains its own windowing systems, AWT and Swing), and some extensions.
Design
The base
OpenGL C API is accessed in JOGL viaJava 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 attempting to map OpenGL functionality onto the
object-oriented programming paradigm. Indeed, the majority 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 andstate 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 likeJava3D . Because most of the code is autogenerated, changes to OpenGL can be rapidly added to JOGL.Status and Standardization
As of 2007, JOGL provides full access to the
OpenGL 2.0 specification.The last 1.1.0 version is the reference implementation for
JSR -231 (Java Bindings for OpenGL).The upcoming 1.1.1 release will give access to GLU NURBS, providing rendering of curved lines and surfaces via the traditional GLU APIs. It is planned to do a maintenance review of JSR-231 1.1.1 to add NURBS-related entry points to the JSR-231 API.
Java2D / OpenGL interoperability
Since the
Java SE 6 version of the Java programming language,Java2D (theAPI 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 ofOpenGL rendering.
* Draw 3DOpenGL graphics on top ofJava2D rendering (see [http://www.curious-creature.org/2005/12/21/a-swing-button-with-3d-source-codedemo/ here] for a button with an OpenGL icon).
* Use 3D graphics anywhere where ordinarily a Swing widget would be used. (Inside a JTable, JTree, ...)
* DrawJava2D graphics on top of 3DOpenGL rendering.3D Tetrahedron Example
This program displays a simple 3D rendering of a tetrahedron using JOGL.
JavaRenderer
class—This class usesGLAutoDrawable
to render the 3D scene.JavaDia
class—The main class links theJavaRenderer
class. The code draws the 3D scene to aGLCanvas
.ee also
*
Xith3D : a scene graph based graphics API that uses JOGL
* LWJGL : another open-source OpenGL wrapper library
*Java Bindings for OpenGL
* "Wurm Online ", an MMORPG simulator that uses JOGL
*RuneScape , another MMORPG using JOGL
*Elflight Engine : a high performance 3D game engine optimised for the web
*JMonkey Engine : a high performance scene graph based graphics API that uses LWJGL
*Jake2 , a Java port ofQuake II using JOGL or LWJGL for its low-level graphic APIExternal links
* [https://jogl.dev.java.net/ JOGL at Java.net]
* [http://www.jcp.org/en/jsr/detail?id=231 JSR-231 "Java Bindings for OpenGL" website]
* [http://ak.kiet.le.googlepages.com/theredbookinjava.html tool kiet] - The OpenGL Programming Guide examples using JOGL.
* [http://nehe.gamedev.net/ NeHe's tutorials and sample code]
* [http://pepijn.fab4.be/software/nehe-java-ports/ JOGL port of the Nehe tutorials]
* [http://download.java.net/media/jogl/builds/nightly/javadoc_public/overview-summary.html JSR 231 Specification (draft)]
* [http://timelessname.com/jogl/lesson01/ Setting up JOGL in Eclipse]
* [https://netbeans-opengl-pack.dev.java.net/ NetBeans OpenGL Pack] - OpenGL Development Environment plugin for theNetBeans IDE
* [http://demo.dzzd.net/Viewer3D/ Viewer3D] - An applet to display interactive 3D content with JOGL.
Wikimedia Foundation. 2010.