# 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 multimedia titles, such as Vulkan, OpenGL, 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. It is also the basis of many high-level Java game engines and libraries, such as libGDX or the jMonkeyEngine.

## History

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. Many new bindings, including GLFW, EGL and Objective-C, were added. 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.

## Bindings

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.
Provided bindings :
| Binding | Category | Description | Notes |
| EGL | Khronos APIs | Interface between Khronos rendering APIs and the underlying native platform window system. | |
| OpenCL | Khronos APIs | API for cross-platform parallel computing. | |
| OpenGL | Khronos APIs | 3D graphics specification implemented by most GPU vendors. | Most extensions are supported, but less popular ones will be added on request. |
| OpenGL ES | Khronos APIs | OpenGL for embedded systems like mobile phones, tablets, or consoles. | |
| Vulkan | Khronos APIs | Upcoming cross-platform 3D graphics API. | |
| GLFW | Display and Input | Window management library needed for handling OpenGL and Vulkan contexts as well as user input. | |
| JAWT | Display and Input | AWT native interface. | |
| nfd | Display and Input | Small cross-platform native file dialogs library. | |
| tinyfd | Display and Input | Small native dialog library. | |
| OpenAL | Audio | Three-dimensional audio API. | ALC and other extensions are supported. Specifically bundles the OpenAL Soft implementation. |
| Opus | Audio | Open, royalty-free audio codec. | |
| Assimp | Graphics | Portable open source library to import various 3D model formats. | |
| bgfx | Graphics | Cross-platform rendering library supporting multiple graphics backends. | |
| DriftFX | Graphics | Library to render OpenGL content into JavaFX nodes. | |
| LibOVR | Graphics | API of the Oculus Rift SDK. | |
| meshoptimizer | Graphics | A mesh optimization library that makes meshes smaller and faster to render | |
| NanoSVG | Graphics | Simple SVG parser. | |
| NanoVG | Graphics | 2D vector graphics rendering library using OpenGL. | |
| Nuklear | Graphics | Simple GUI library. | |
| par_shapes | Graphics | Generator for parametric and other simple shapes. | |
| par_streamlines | Graphics | Triangulate wide lines and curves. | |
| OpenVR | Graphics | An API runtime that allows access to VR hardware from multiple vendors without requiring applications have specific knowledge of the type of hardware they are targeting. | |
| Shaderc | Graphics | A collection of libraries for shader compilation | |
| SPIRV-Cross | Graphics | A library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages. | |
| OpenEXR | Graphics | A small, single-header library to load and save OpenEXR (.exr) images. | |
| Tootle (AMD) | Graphics | A 3D triangle mesh optimization library that improves on existing mesh preprocessing techniques. | |
| Vulkan Memory Allocator | Graphics | An easy to integrate Vulkan memory allocation library. | |
| Yoga | Graphics | An open-source, cross-platform layout library that implements CSS Flexbox. | |
| STB | STB | Lightweight single-file libraries for loading images, sounds and fonts. | |
| Bullet Physics | Other | Real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine-learning, etc. | |
| CUDA | Other | A parallel computing platform and programming model developed by NVIDIA for general computing on GPUs. | |
| dyncall | Other | Library for dynamically calling C functions in a portable way. | Set to be removed. |
| jemalloc | Other | Low-level memory management. | |
| libffi | Other | A portable, high level programming interface to various calling conventions. | Replaces dyncall. |
| libdivide | Other | A library that replaces expensive integer divides with comparatively cheap multiplication and bitshifts. | |
| LLVM | Other | A collection of modular and reusable compiler and toolchain technologies. | |
| LMDB | Other | Fast database library using memory-mapped files. | |
| LZ4 | Other | A lossless data compression algorithm that is focused on speed. | |
| Meow Hash | Other | Fast non-cryptographic hash. | |
| ODBC | Other | A C-language interface that makes it possible for applications to access data from a variety of database management systems. | |
| Remotery | Other | Realtime CPU/GPU profiler. | |
| rpmalloc | Other | Cross-platform thread caching memory allocator. | |
| xxHash | Other | Fast hash algorithm. | |
| Zstandard | Other | A fast lossless compression algorithm. | |

## Notable uses

* Minecraft: Java Edition
* Project Zomboid
* Necesse