LWJGL 3 includes Khronos bindings for GPU compute, augmented and virtual reality, and low-level rendering surface management. These bindings target specialized workloads — parallel computation on heterogeneous hardware, immersive XR experiences, and platform-neutral surface creation — that sit alongside the main graphics pipeline.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/LWJGL/lwjgl3/llms.txt
Use this file to discover all available pages before exploring further.
The current stable release is 3.4.2. All bindings listed here are optional modules. Use the LWJGL build configurator to generate Maven or Gradle dependency declarations.
OpenCL
Maven artifact:org.lwjgl:lwjgl-openclKey classes:
CL10, CL11, CL12, CL20, CL21, CL30, CLPlatform, CLDevice, CLContext, CLCommandQueue, CLKernel
OpenCL is an open, royalty-free standard for cross-platform, parallel programming of diverse processors — CPUs, GPUs, DSPs, and FPGAs. LWJGL exposes the full OpenCL specification through per-version classes (CL10 through CL30), giving you direct, high-performance access to every entry point.
OpenCL object model:
| Object | Purpose |
|---|---|
CLPlatform | Represents an OpenCL implementation (e.g., the NVIDIA or Intel driver) |
CLDevice | An individual compute device (GPU, CPU, accelerator) |
CLContext | Manages a set of devices and their shared memory objects |
CLCommandQueue | Submits commands (kernel dispatches, memory transfers) to a device |
CLProgram / CLKernel | Compiled OpenCL C source and an individual kernel entry point |
CLMem | Device-side memory buffer or image object |
| Class | Standard | Notable additions |
|---|---|---|
CL10 | OpenCL 1.0 | Core platform, context, queue, buffer, kernel APIs |
CL11 | OpenCL 1.1 | Sub-buffers, user events, clSetMemObjectDestructorCallback |
CL12 | OpenCL 1.2 | clCompileProgram, clLinkProgram, partitioned devices, image arrays |
CL20 | OpenCL 2.0 | Shared virtual memory (SVM), device-side enqueue, pipes |
CL21 | OpenCL 2.1 | SPIR-V ingestion, clGetHostTimer, sub-group queries |
CL30 | OpenCL 3.0 | Feature queries, cl_khr_extended_versioning |
KHRGLSharing.clCreateContextFromType(), then acquire and release GL buffer/texture objects in the command queue to avoid redundant data copies between compute and rendering.
OpenXR
Maven artifact:org.lwjgl:lwjgl-openxrKey classes:
XR10, XrInstance, XrSession, XrSpace, XrSwapchain, XrFrameState, XrCompositionLayerProjection
OpenXR is a royalty-free, open standard from Khronos that provides unified access to Augmented Reality (AR) and Virtual Reality (VR) — collectively known as XR — platforms and devices. It replaces proprietary SDKs (Oculus, SteamVR, WMR) with a single API surface.
Core XR concepts:
| Concept | Description |
|---|---|
XrInstance | Connection to the OpenXR runtime. One per application. |
XrSystem | The XR hardware (headset + controllers) attached to the runtime |
XrSession | An active XR experience; manages the frame loop |
XrSpace | A frame of reference: stage (room scale), local (seated), or view (HMD) |
XrSwapchain | A set of GPU-renderable images for one eye (or layer) |
XrAction | An abstract input action (grip, trigger, pose) bound to physical controllers |
XR10.xrEnumerateInstanceExtensionProperties() and enable them at instance creation. Common extensions include:
| Extension | Purpose |
|---|---|
XR_KHR_opengl_enable | Use OpenGL as the graphics backend |
XR_KHR_vulkan_enable2 | Use Vulkan as the graphics backend |
XR_EXT_hand_tracking | Per-joint hand skeleton data |
XR_FB_passthrough | Mixed-reality passthrough camera |
XR_MSFT_spatial_anchor | Persistent world-locked anchors |
EGL
Maven artifact:org.lwjgl:lwjgl-eglKey classes:
EGL, EGL10, EGL11, EGL12, EGL13, EGL14, EGL15, EGLCapabilities
EGL is the Khronos interface between rendering APIs (OpenGL ES, OpenVG, and, via extensions, desktop OpenGL and Vulkan) and the underlying native platform window system. It handles surface creation, context management, and buffer swapping in a platform-neutral way.
Where EGL is used:
| Platform | Role |
|---|---|
| Android | Primary window system integration for OpenGL ES |
| Embedded Linux (without X11/Wayland) | Direct framebuffer rendering |
| Offscreen / headless rendering | Create surfaceless contexts for compute-only or server-side rendering |
| NVIDIA / Mesa desktop | Desktop OpenGL via EGL_KHR_platform_gbm or EGL_KHR_platform_x11 |
On desktop Linux with a display server, GLFW handles EGL internally when you set the
GLFW_PLATFORM hint to GLFW_PLATFORM_WAYLAND. Use the bare EGL binding only when you need direct EGL control — for example, in headless server-side rendering or when integrating with a non-GLFW window system.Choosing a Compute or XR Backend
| Workload | Recommended binding |
|---|---|
| General-purpose GPU compute (image processing, ML inference, simulation) | OpenCL (org.lwjgl:lwjgl-opencl) |
| Vulkan-native compute shaders | Vulkan (org.lwjgl:lwjgl-vulkan) |
| Headset / AR / VR application | OpenXR (org.lwjgl:lwjgl-openxr) |
| Headless OpenGL ES (server, CI, embedded) | EGL (org.lwjgl:lwjgl-egl) |
| Embedded platform with no X11/Wayland | EGL + OpenGL ES |