Remove ads
From Wikipedia, the free encyclopedia
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).
Developer(s) | JogAmp Community |
---|---|
Stable release | 2.5.0
/ August 18, 2023 |
Preview release | n/a
/ tbd |
Written in | Java, C |
Operating system | Cross-platform |
Type | 3D computer graphics software (library/API) |
License | BSD license |
Website | jogamp |
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, and some extensions.
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.
As of 2023[update], JOGL provides full access to the OpenGL 4.5 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.3.2 release added support for OpenGL versions up to 4.5, and OpenGL ES versions up to 3.2.
Wayland and Vulkan support is planned.[6]
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 :
@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);
}
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.