Java OpenGL

Last updated
JOGL
Developer(s) JogAmp Community
Stable release
2.5.0 / August 18, 2023;4 months ago (2023-08-18)
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.org/jogl/www/ OOjs UI icon edit-ltr-progressive.svg

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).

Contents

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.

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.

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 and Vulkan 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 :

Tutorials

Code examples

@Overridepublicvoiddisplay(GLAutoDrawabledrawable){GL4gl4=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 *= viewtransformPointer.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

Related Research Articles

<span class="mw-page-title-main">OpenGL</span> Cross-platform graphics API

OpenGL is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering.

Direct3D is a graphics application programming interface (API) for Microsoft Windows. Part of DirectX, Direct3D is used to render three-dimensional graphics in applications where performance is important, such as games. Direct3D uses hardware acceleration if it is available on the graphics card, allowing for hardware acceleration of the entire 3D rendering pipeline or even only partial acceleration. Direct3D exposes the advanced graphics capabilities of 3D graphics hardware, including Z-buffering, W-buffering, stencil buffering, spatial anti-aliasing, alpha blending, color blending, mipmapping, texture blending, clipping, culling, atmospheric effects, perspective-correct texture mapping, programmable HLSL shaders and effects. Integration with other DirectX technologies enables Direct3D to deliver such features as video mapping, hardware 3D rendering in 2D overlay planes, and even sprites, providing the use of 2D and 3D graphics in interactive media ties.

<span class="mw-page-title-main">OpenAL</span> API for rendering audio

OpenAL is a cross-platform audio application programming interface (API). It is designed for efficient rendering of multichannel three-dimensional positional audio. Its API style and conventions deliberately resemble those of OpenGL. OpenAL is an environmental 3D audio library, which can add realism to a game by simulating attenuation, the Doppler effect, and material densities.

GLX is an extension to the X Window System core protocol providing an interface between OpenGL and the X Window System as well as extensions to OpenGL itself. It enables programs wishing to use OpenGL to do so within a window provided by the X Window System. GLX distinguishes two "states": indirect state and direct state.

<span class="mw-page-title-main">Volume rendering</span> Representing a 3D-modeled object or dataset as a 2D projection

In scientific visualization and computer graphics, volume rendering is a set of techniques used to display a 2D projection of a 3D discretely sampled data set, typically a 3D scalar field.

Jakarta XML Binding is a software framework that allows Java EE developers to map Java classes to XML representations. JAXB provides two main features: the ability to marshal Java objects into XML and the inverse, i.e. to unmarshal XML back into Java objects. In other words, JAXB allows storing and retrieving data in memory in any XML format, without the need to implement a specific set of XML loading and saving routines for the program's class structure. It is similar to xsd.exe and XmlSerializer in the .NET Framework.

Direct3D and OpenGL are competing application programming interfaces (APIs) which can be used in applications to render 2D and 3D computer graphics. As of 2005, graphics processing units (GPUs) almost always implement one version of both of these APIs. Examples include: DirectX 9 and OpenGL 2 circa 2004; DirectX 10 and OpenGL 3 circa 2008; and most recently, DirectX 11 and OpenGL 4 circa 2011. GPUs that support more recent versions of the standards are backwards compatible with applications that use the older standards; for example, one can run older DirectX 9 games on a more recent DirectX 11-certified GPU.

The Khronos Group, Inc. is an open, non-profit, member-driven consortium of 170 organizations developing, publishing and maintaining royalty-free interoperability standards for 3D graphics, virtual reality, augmented reality, parallel computation, vision acceleration and machine learning. The open standards and associated conformance tests enable software applications and middleware to effectively harness authoring and accelerated playback of dynamic media across a wide variety of platforms and devices. The group is based in Beaverton, Oregon.

<span class="mw-page-title-main">Java 3D</span> Java 3D graphics API

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 1.6.0, which runs on top of Java OpenGL (JOGL). Since version 1.2, Java 3D has been developed under the Java Community Process. A Java 3D scene graph is a directed acyclic graph (DAG).

Glide is a 3D graphics API developed by 3dfx Interactive for their Voodoo Graphics 3D accelerator cards. Although it originally started as a proprietary API, it was later open sourced by 3dfx. It was dedicated to rendering performance, supporting geometry and texture mapping primarily, in data formats identical to those used internally in their cards. Wide adoption of 3Dfx led to Glide being extensively used in the late 1990s, but further refinement of Microsoft's Direct3D and the appearance of full OpenGL implementations from other graphics card vendors, in addition to growing diversity in 3D hardware, eventually caused it to become superfluous.

<span class="mw-page-title-main">OpenGL ES</span> Subset of the OpenGL API for embedded systems

OpenGL for Embedded Systems is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accelerated using a graphics processing unit (GPU). It is designed for embedded systems like smartphones, tablet computers, video game consoles and PDAs. OpenGL ES is the "most widely deployed 3D graphics API in history".

GlueGen is a Java tool which automatically generates the Java and Java Native Interface (JNI) code needed to call C libraries from Java code. It reads in ANSI C header files and GlueGen configuration files, and emits C code. As JNI can be complex, Gluegen simplifies the process of binding Java to C native libraries.

<span class="mw-page-title-main">Perl OpenGL</span>

Perl OpenGL (POGL) is a portable, compiled wrapper library that allows OpenGL to be used in the Perl programming language.

Java Binding for the OpenGL API is a JSR API specification for the Java Platform, Standard Edition which allows to use OpenGL on the Java. There is also Java Binding for the OpenGL ES API for the Java Platform, Micro Edition.

The phoneME project is Sun Microsystems reference implementation of Java virtual machine and associated libraries of Java ME with source, licensed under the GNU General Public License.

<span class="mw-page-title-main">WebGL</span> JavaScript bindings for OpenGL in web browsers

WebGL is a JavaScript API for rendering interactive 2D and 3D graphics within any compatible web browser without the use of plug-ins. WebGL is fully integrated with other web standards, allowing GPU-accelerated usage of physics, image processing, and effects in the HTML canvas. WebGL elements can be mixed with other HTML elements and composited with other parts of the page or page background.

<span class="mw-page-title-main">EGL (API)</span> Application programming interface

EGL is an interface between Khronos rendering APIs and the underlying native platform windowing system. EGL handles graphics context management, surface/buffer binding, rendering synchronization, and enables "high-performance, accelerated, mixed-mode 2D and 3D rendering using other Khronos APIs." EGL is managed by the non-profit technology consortium Khronos Group.

<span class="mw-page-title-main">Mobile 3D Graphics API</span>

The Mobile 3D Graphics API, commonly referred to as M3G, is a specification defining an API for writing Java programs that produce 3D computer graphics. It extends the capabilities of the Java ME, a version of the Java platform tailored for embedded devices such as mobile phones and PDAs. The object-oriented interface consists of 30 classes that can be used to draw complex animated three-dimensional scenes. M3G was developed under the Java Community Process as JSR 184. As of 2007, the current version of M3G is 1.1, but version 2.0 is in development as JSR 297.

This is a glossary of terms relating to computer graphics.

References

  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 https://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".