Java OpenGL (JOGL) is a wrapper
library
A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vi ...
that allows
OpenGL
OpenGL (Open Graphics Library) 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 ha ...
to be used in the
Java programming language
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers ''write once, run an ...
. It was originally developed by Kenneth Bradley Russell and Christopher John Kline, and was further developed by the
Sun Microsystems
Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, ...
Game Technology Group. Since 2010, it has been an independent
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
project under a
BSD license
BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the use and distribution of covered software. This is in contrast to copyleft licenses, which have share-alike requirements. The original BSD li ...
. 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
In software design, the Java Native Interface (JNI) is a foreign function interface programming framework that enables Java code running in a Java virtual machine (JVM) to call and be called by
native applications (programs specific to a hardwa ...
(JNI). It offers access to both the standard GL* functions along with the GLU* functions; however the
OpenGL Utility Toolkit
The OpenGL Utility Toolkit (GLUT) is a library of utilities for OpenGL programs, which primarily perform system-level I/O with the host operating system. Functions performed include window definition, window control, and monitoring of keyboard ...
(GLUT) library is not available for window-system related calls, as Java has its own windowing systems:
Abstract Window Toolkit
The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit, preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphica ...
(AWT),
Swing
Swing or swinging may refer to:
Apparatus
* Swing (seat), a hanging seat that swings back and forth
* Pendulum, an object that swings
* Russian swing, a swing-like circus apparatus
* Sex swing, a type of harness for sexual intercourse
* Swing rid ...
, and some
extensions
Extension, extend or extended may refer to:
Mathematics
Logic or set theory
* Axiom of extensionality
* Extensible cardinal
* Extension (model theory)
* Extension (predicate logic), the set of tuples of values that satisfy the predicate
* Ext ...
.
Design
The base
OpenGL
OpenGL (Open Graphics Library) 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 ha ...
C API, as well as its associated
Windowing API, are accessed in JOGL via
Java Native Interface
In software design, the Java Native Interface (JNI) is a foreign function interface programming framework that enables Java code running in a Java virtual machine (JVM) to call and be called by
native applications (programs specific to a hardwa ...
(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
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
paradigm. Indeed, most of the JOGL code is autogenerated from the OpenGL C header files via a conversion tool named ''
GlueGen {{Infobox software
, name = GlueGen
, logo =
, screenshot =
, caption =
, developer = Sun Microsystems Game Technology Group
JogAmp Community '', which was programmed specifically to facilitate the creation of JOGL.
Status and standardization
, JOGL provides full access to the
OpenGL
OpenGL (Open Graphics Library) 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 ha ...
4.5 specification as well as almost all vendor extensions (and
OpenCL
OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), field-prog ...
,
OpenMAX
OpenMAX (Open Media Acceleration), often shortened as "OMX", is a non-proprietary and royalty-free cross-platform set of C-language programming interfaces. It provides abstractions for routines that are especially useful for processing of audio, ...
and
OpenAL
OpenAL (Open Audio Library) 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 ...
). The 1.1.0 version is the reference implementation for
JSR-231 (Java Bindings for OpenGL). The 1.1.1 release gave limited access to
GLU NURBS
Non-uniform rational basis spline (NURBS) is a mathematical model using basis splines (B-splines) that is commonly used in computer graphics for representing curves and surfaces. It offers great flexibility and precision for handling both analy ...
, 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.
Java2D-OpenGL interoperability
Since the
Java SE 6
The Java language has undergone several changes since JDK 1.0 as well as numerous additions of classes and packages to the standard library. Since J2SE 1.4, the evolution of the Java language has been governed by the Java Communit ...
version of the
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
language,
Java2D
Java 2D is an API for drawing two-dimensional graphics using the Java programming language. Every Java 2D drawing operation can ultimately be treated as ''filling'' a ''shape'' using a ''paint'' and ''compositing'' the result onto the screen.
...
(the
API
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
for drawing two dimensional graphics in Java) and JOGL have become interoperable, allowing it to :
* Overlay
Swing
Swing or swinging may refer to:
Apparatus
* Swing (seat), a hanging seat that swings back and forth
* Pendulum, an object that swings
* Russian swing, a swing-like circus apparatus
* Sex swing, a type of harness for sexual intercourse
* Swing rid ...
components (lightweight menus, tooltips, and other
widgets) on top of
OpenGL
OpenGL (Open Graphics Library) 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 ha ...
rendering.
* Draw 3D
OpenGL
OpenGL (Open Graphics Library) 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 ha ...
graphics on top of
Java2D
Java 2D is an API for drawing two-dimensional graphics using the Java programming language. Every Java 2D drawing operation can ultimately be treated as ''filling'' a ''shape'' using a ''paint'' and ''compositing'' the result onto the screen.
...
rendering (se
herefor a button with an OpenGL icon).
* Use 3D graphics anywhere where ordinarily a
Swing
Swing or swinging may refer to:
Apparatus
* Swing (seat), a hanging seat that swings back and forth
* Pendulum, an object that swings
* Russian swing, a swing-like circus apparatus
* Sex swing, a type of harness for sexual intercourse
* Swing rid ...
widget would be used. (Inside a JTable, JTree, ...)
* Draw
Java2D
Java 2D is an API for drawing two-dimensional graphics using the Java programming language. Every Java 2D drawing operation can ultimately be treated as ''filling'' a ''shape'' using a ''paint'' and ''compositing'' the result onto the screen.
...
graphics on top of 3D
OpenGL
OpenGL (Open Graphics Library) 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 ha ...
rendering.
Tutorials
OpenGL ES 2sample
Hello Triangle gl3 and gl4 Hello Triangle and Texture. The samples are offered in Java and
Kotlin
Java OpenGL Sample Pack porting o
The over 230 samples illustrate almost all OpenGL features ranging from ES 2.0 up to the last GL extensions, same of them usually also called
AZDO (Almost Zero Driver Overhead).
modern jogl examples Porting of
Learning Modern 3D Graphics Programming, Jason L. McKesson'' Java and Kotlin side by side.
Immediate modesample (simplest example, using the fixed pipeline)
Code examples
@Override
public void display(GLAutoDrawable drawable)
See also
*
Java Bindings for OpenGL, The Java Community Specification Request for which JOGL provides an implementation
*
Ardor3D
jMonkeyEngine (abbreviated JME) is a game engine for developing 3D games written in Java. It uses shader technology extensively and can be used to write games for Windows, Linux, macOS, Raspberry Pi, and Android. It uses Lightweight Java Gam ...
, 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
jMonkeyEngine (abbreviated JME) is a game engine for developing 3D games written in Java. It uses shader technology extensively and can be used to write games for Windows, Linux, macOS, Raspberry Pi, and Android. It uses Lightweight Java Gam ...
, a high performance scene graph based graphics API using several bindings for OpenGL and OpenGL-ES including JOGL
*
Poxnora
''PoxNora: Battlefield of the Immortals'' is a multiplayer online game that combines a digital collectible card game with a turn-based strategy game in a fantasy setting. ''PoxNora'' was originally launched via Java Web Start through a browser ...
, an online multiplayer game using JOGL
*
RuneScape
''RuneScape'' is a fantasy massively multiplayer online role-playing game (MMORPG) developed and published by Jagex, released in January 2001. ''RuneScape'' was originally a browser game built with the Java programming language; it was la ...
, a MMORPG using JOGL
*
Jake2
Jake2 is a Java port of the GPL release of the Quake II game engine.
History
The 0.9.1 version of Jake2 was shown by the JOGL team for JavaOne 2004, to present an example of Java-OpenGL interoperability. Jake2 has since been used by Sun as a ...
, a Java port of
Quake II
''Quake II'' is a 1997 first-person shooter video game developed by id Software and published by Activision. It is the second installment of the ''Quake'' series, but not a direct sequel to '' Quake''. The game's storyline is continued in its e ...
using several bindings for OpenGL including JOGL for its low-level graphic API
*
Scilab
Scilab is a free and open-source, cross-platform numerical computational package and a high-level, numerically oriented programming language. It can be used for signal processing, statistical analysis, image enhancement, fluid dynamics simula ...
, 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
The Lightweight Java Game Library (LWJGL) is an open-source software library that provides bindings to a variety of C libraries for video game developers to Java. It exposes cross-platform libraries commonly used in developing video games and ...
, an alternative open-source OpenGL wrapper library
*
Java OpenAL
Java OpenAL (JOAL) is one of several wrapper libraries that allows Java programmers to access OpenAL. This allows Java programmers to use 3D sound in applications. JOAL is one of the libraries developed by the Sun Microsystems Game Technology ...
*
Java OpenCL
References
External links
*
JOGL 2.3.x SpecificationJSR-231 Java Bindings for OpenGLwebsite
The OpenGL Programming Guide examples using JOGL
NeHe's tutorials and sample codeSetting up a JogAmp JOGL project in your favorite IDEViewer3D an applet to display interactive 3D content with JOGL
Eclipse OpenGL PackOpenGL plugin for the
Eclipse
An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three ce ...
IDE
{{Java desktop
3D graphics software
Java (programming language) libraries
Java APIs
OpenGL
Software using the BSD license