JOGL
DeveloperJogAmp Community
Stable release
2.6.0 / August 31, 2025; 9 months ago (2025-08-31)
Preview release
n/a / tbd
Written inJava, C
Operating systemCross-platform
Type3D computer graphics software (library/API)
LicenseBSD license
Websitejogamp.org/jogl/www/ Edit this at Wikidata

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 Game Technology Group at Sun Microsystems. 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 the 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, JavaFX, SWT, its own NEWT and some extensions.

Design

edit

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.

Status and standardization

edit

As of 2025, JOGL provides full access to the OpenGL 4.6 and OpenGL ES 3.2 specification as well as almost all vendor extensions (and OpenCL, OpenMAX and OpenAL).[4] The 2.5.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.6.0 release added support for OpenGL versions up to 4.6, and OpenGL ES versions up to 3.2.

Wayland and Vulkan support is planned.[6]

Java2D-OpenGL interoperability

edit

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.

Tutorials

edit

Code example

edit
    @Override
    public void display(GLAutoDrawable drawable) {

        GL4 gl4 = drawable.getGL().getGL4();

        gl4.glClearBufferfv(GL2ES3.GL_COLOR, 0, clearColor);
        gl4.glClearBufferfv(GL2ES3.GL_DEPTH, 0, clearDepth);

        {
            FloatUtil.makeLookAt(view, 0, eye, 0, at, 0, up, 0, tmp);
            FloatUtil.makePerspective(projection, 0, reset, 45f, aspect, near, far);

            FloatUtil.multMatrix(projection, view); // projection *= view

            transformPointer.asFloatBuffer().put(projection);
        }

        gl4.glUseProgram(programName);
        gl4.glBindVertexArray(vertexArrayName.get(0));
        gl4.glBindBufferBase(GL2ES3.GL_UNIFORM_BUFFER /*target*/, 1 /*TRANSFORM0, index*/, bufferName.get(2) /*TRANSFORM, buffer*/);

        gl4.glBindTextureUnit(0 /*diffuse*/, textureName.get(0));
        gl4.glBindSampler(0 /*diffuse*/, samplerName.get(0));

        gl4.glDrawElements(GL.GL_TRIANGLES, elementCount, GL.GL_UNSIGNED_SHORT, 0);
    }

See also

edit
  • 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
  • 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
  • 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
  • Java OpenAL

References

edit
  1. ^ Friesen, Jeff (September 18, 2008). "Open source Java projects: Java Binding for OpenGL (JOGL)". Open Source Java Tutorials. JavaWorld. Retrieved 2020-07-23. JOGL originated as a project named Jungle, which was created by 3D graphics experts Ken Russell (of Sun Microsystems) and Chris Kline (of Irrational Games).
  2. ^ Davis, Gene (February 21, 2005). "Hello JOGL". JavaWorld. Retrieved 2020-07-23.
  3. ^ "3D & Multimedia Across Platforms and Devices Using JOGL" (PDF). SIGGRAPH. 2010-07-27. Retrieved 2011-02-06.
  4. ^ "JOGL - Java Binding for the OpenGL API".
  5. ^ "JSR-000231 Java Bindings for the OpenGL API". Java Community Process. Retrieved 2011-02-06. In order to facilitate maximum community participation for the Java Binding for the OpenGL API, we use the JOGL project on java.net found at jogl.dev.java.net. The JOGL source code can be found there, licensed under a liberal source code license (mostly licensed as BSD except where we use other parties' licensed code). We take a snapshot of the code from this project every few months, run the Technology Compatibility Kit on the source code, and then officially make it the Reference Implementation for each formal Java Binding for the OpenGL API release.
  6. ^ "Bug 794 - Add Wayland Windowing/Surface Interoperability". 2013-08-05.
  7. ^ "JOGL Userguide".
edit

📚 Artikel Terkait di Wikipedia

Java Bindings for OpenGL

Java Binding for the OpenGL API is a JSR API specification (JSR 231) for the Java Platform, Standard Edition which allows to use OpenGL on the Java (software

OpenGL Shading Language

WebGL, an OpenGL-ES dialect for web browsers, which uses GLSL for shaders Shadertoy LWJGL, a library that includes Java bindings for OpenGL. ARB assembly

OpenGL

As such, OpenGL has many language bindings, some of the most noteworthy being the JavaScript binding WebGL (API, based on OpenGL ES 2.0, for 3D rendering

Java Platform, Micro Edition

Java Platform, Micro Edition or Java ME is a computing platform for development and deployment of portable code for embedded and mobile devices (micro-controllers

List of widget toolkits

desktop applications both through JavaSE and via a JavaScript pipeline through browsers java-gnome provides bindings to the GTK toolkit and other libraries

Java Community Process

standard technical specifications for Java technology. Becoming a member of the JCP requires solid knowledge of the Java programming language, its specifications

OpenGL ES

OpenGL for Embedded Systems (OpenGL ES or GLES) is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering

Java 3D

Java 3D is a scene graph-based 3D application programming interface (API) for the Java platform. It runs on top of either OpenGL or Direct3D until version