Reference articles on history, science, culture and more
Encyclopedia

LWJGL

Open-source Java software game library

Image credit is listed at the end of this article.

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 multimedia titles, such as Vulkan, OpenGL, GLFW, OpenAL and OpenCL.

The primary goal of the project is to provide a way for Java developers to get access to resources that are otherwise unavailable or poorly implemented on the existing Java platform. The main philosophy is to expose underlying technology as a thin wrapper, thus creating an API close to the original. LWJGL is the basis of certain high-level Java game engines and libraries, such as libGDX and jMonkeyEngine.

01History

Development of the library began in 2002 with the release of J2SE 1.4, making use of the newly-added non-blocking I/O operations and off-heap memory access. These additions to the JDK allowed for better access to native memory and libraries not a part of the JDK. The first official release of the library was on 4 February 2007.

On 13 November 2014, version 3 was announced, which was released in the alpha version on 27 April 2015 and is a complete rewrite of LWJGL. Version 3 added support for Vulkan, and many new bindings, including GLFW, EGL and Objective-C. Support for Oculus Rift development was also added with LibOVR bindings. The new version was released on 4 June 2016, after more than 3 and a half years in development.

02Bindings

The library accesses native C code through the Java Native Interface (JNI). Bindings to each of the native libraries exist as different modules so developers can make custom builds with only the things they need in a certain program.

While utility classes are written in pure Java, most of the binding classes are automatically generated by a custom generator implemented in Kotlin.

Since version 3.1, LWJGL is fully split into 51 modules that can be downloaded and used separately. To make this process easier, the project provides an online build configurator, which allows users to download custom combinations of modules and automatically generates Maven and Gradle configuration files to ease their use with existing projects.

03Notable uses

Watch videos about LWJGLExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article LWJGL, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Images, from Wikimedia Commons:

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.