HOME

TheInfoList



OR:

Java OpenGL (JOGL) is a wrapper
library A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
that allows
OpenGL OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
to be used in the
Java programming language Java is a high-level, general-purpose, memory-safe, object-oriented programming language. It is intended to let programmers ''write once, run anywhere'' ( WORA), meaning that compiled Java code can run on all platforms that support Jav ...
. It was originally developed by Kenneth Bradley Russell and Christopher John Kline, and was further developed by the Game Technology Group at
Sun Microsystems Sun Microsystems, Inc., often known as Sun for short, was an American technology company that existed from 1982 to 2010 which developed and sold computers, computer components, software, and information technology services. Sun contributed sig ...
. 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 and view the source code, design documents, or content of the product. The open source model is a decentrali ...
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 lic ...
. 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, and some extensions.


Design

The base
OpenGL OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
C API, as well as its associated Windowing API, 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 Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impl ...
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

, JOGL provides full access to the
OpenGL OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
4.5 specification as well as almost all vendor extensions (and
OpenCL OpenCL (Open Computing Language) is a software framework, framework for writing programs that execute across heterogeneous computing, heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), di ...
, OpenMAX and OpenAL). The 2.5.0 version is the reference implementation for JSR-231 (Java Bindings for OpenGL). 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.


Java2D-OpenGL interoperability

Since the Java SE 6 version of the
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
language, Java2D (the
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
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 OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
rendering. * Draw 3D
OpenGL OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
graphics on top of Java2D rendering (se
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 OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
rendering.


Tutorials


OpenGL ES 2
sample
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 mode
sample (simplest example, using the Fixed-function
graphics pipeline The computer graphics pipeline, also known as the rendering pipeline, or graphics pipeline, is a framework within computer graphics that outlines the necessary procedures for transforming a three-dimensional (3D) scene into a two-dimensional (2 ...
)


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, 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 ''Quake II'' is a 1997 first-person shooter, first-person shooter game developed by id Software and published by Activision. It is the second installment of the Quake (series), ''Quake'' series, following ''Quake (video game), Quake''. Develope ...
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 simul ...
, 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


External links

*
JOGL 2.3.x Specification

JSR-231 Java Bindings for OpenGL
website

, The OpenGL Programming Guide examples using JOGL
NeHe's tutorials and sample code

Setting up a JogAmp JOGL project in your favorite IDE

Viewer3D
an applet to display interactive 3D content with JOGL
Eclipse OpenGL Pack
OpenGL plugin for the
Eclipse An eclipse is an astronomical event which 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 ...
IDE {{Java desktop 3D graphics software Java (programming language) libraries OpenGL Software using the BSD license