lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL), audio (OpenAL) and parallel computing (OpenCL) applications.

Subscribe to updates I use lwjgl3


Statistics on lwjgl3

Number of watchers on Github 1621
Number of open issues 37
Average time to close an issue 5 days
Main language Kotlin
Average time to merge a PR 2 days
Open pull requests 3+
Closed pull requests 17+
Last commit 11 months ago
Repo Created about 6 years ago
Repo Last Updated 10 months ago
Size 19.3 MB
Homepage https://www.lwjgl...
Organization / Authorlwjgl
Latest Release3.1.6
Contributors12
Page Updated
Do you use lwjgl3? Leave a review!
View open issues (37)
View lwjgl3 activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating lwjgl3 for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Backers on Open Collective Sponsors on Open Collective License Size Build Status Slack Status

LWJGL - Lightweight Java Game Library 3

LWJGL (https://www.lwjgl.org) is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL/Vulkan), audio (OpenAL) and parallel computing (OpenCL) applications. This access is direct and high-performance, yet also wrapped in a type-safe and user-friendly layer, appropriate for the Java ecosystem.

LWJGL is an enabling technology and provides low-level access. It is not a framework and does not provide higher-level utilities than what the native libraries expose. As such, novice programmers are encouraged to try one of the frameworks or game engines that make use of LWJGL, before working directly with the library.

LWJGL is open source software and freely available at no charge.

Useful links:

Contact:

If you'd like to contribute, see doc/README for a quick overview of the project structure, installation instructions and configuration options.

Getting Started

As of version 3.1.0, LWJGL is distributed as a set of modules. Only the core module is required and all bindings are optional (but some bindings depend on other bindings). The easiest way to download LWJGL is to use the build configurator on the website.

The build configurator generates Maven & Gradle declarations that can be added to existing projects. This is the easiest way to use LWJGL while developing.

LWJGL can also be downloaded as a simple set of JAR files. Each module consists of the following files:

  • lwjgl-<module>.jar
  • lwjgl-<module>-sources.jar
  • lwjgl-<module>-javadoc.jar
  • lwjgl-<module>-natives-<platform>.jar (for some bindings)

To compile and run an LWJGL application, the base and natives JAR files of the core module and each binding used should be added to the classpath. LWJGL extracts the natives to a temporary folder and loads them automatically, so no further configuration is necessary. If more customization is required (e.g. when creating a platform-specific installer) the natives may be extracted manually and loaded via java.library.path. See the Configuration class for more options.

LWJGL 3 requires Java 8 or later to build and run and currently supports the following platforms/architectures:

  • Linux x64
  • macOS x64
  • Windows x86
  • Windows x64

Example code:

For migrating LWJGL 2 code to LWJGL 3, see the Migration Guide.

Troubleshooting

Most common issues faced by LWJGL users are trivially addressed with the following:

LWJGLX/debug is a Java Agent that will automatically detect a lot of these issues. It can also generate a trace log that's useful when reporting issues to LWJGL.

When asking for help or when you suspect a bug in LWJGL, preparing an MVCE (Minimal, Complete, and Verifiable example) that reproduces the issue will improve the chances of a quick and useful response.

List of Supported Bindings

Khronos APIs

Library Description
EGL An interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform window system.
OpenCL An open, royalty-free standard for cross-platform, parallel programming of diverse processors found in personal computers, servers, mobile devices and embedded platforms.
OpenGL The most widely adopted 2D and 3D graphics API in the industry, bringing thousands of applications to a wide variety of computer platforms.
OpenGL ES A royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems - including consoles, phones, appliances and vehicles.
Vulkan A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms.

Display and Input

Library Description
GLFW Create multiple windows, handle user input (keyboard, mouse, gaming peripherals) and manage contexts. Also features multi-monitor support, clipboard access, file drag-n-drop, and much more.
JAWT The AWT native interface.
nfd A tiny, neat C library that portably invokes native file open and save dialogs.
tinyfd A native dialog library.

Audio

Library Description
OpenAL A cross-platform 3D audio API appropriate for use with gaming applications and many other types of audio applications.
OpenAL Soft An LGPL-licensed, cross-platform, software implementation of the OpenAL 3D audio API.

Graphics

Library Description
Assimp A portable Open Source library to import various well-known 3D model formats in a uniform manner.
bgfx Cross-platform, graphics API agnostic, Bring Your Own Engine/Framework style rendering library, licensed under permissive BSD-2 clause open source license.
LibOVR The API of the Oculus SDK.
NanoSVG A simple stupid SVG parser.
NanoVG A small antialiased vector graphics rendering library for OpenGL.
Nuklear A minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain.
par_shapes Generate parametric surfaces and other simple shapes.
OpenVR An API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting.
Tiny OpenEXR A small, single header-only library to load and save OpenEXR(.exr) images.
Tootle (AMD) A 3D triangle mesh optimization library that improves on existing mesh preprocessing techniques.
Vulkan Memory Allocator An easy to integrate Vulkan memory allocation library.
Yoga An open-source, cross-platform layout library that implements Flexbox.

stb - single-file public domain libraries for C/C++

Library Description
stb_easy_font Quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc.
stb_image Image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
stb_image_resize Resize images larger/smaller with good quality.
stb_image_write Image writing to disk: PNG, TGA, BMP
stb_perlin Revised Perlin noise (3D input, 1D output).
stb_rect_pack Simple 2D rectangle packer with decent quality.
stb_truetype Parse, decode, and rasterize characters from truetype fonts.
stb_vorbis Decode ogg vorbis files from file/memory to float/16-bit signed output.

Other

Library Description
dyncall Encapsulates architecture-, OS- and compiler-specific function call semantics in a virtual bind argument parameters from left to right and then call interface allowing programmers to call C functions in a completely dynamic manner.
jemalloc A general purpose malloc implementation that emphasizes fragmentation avoidance and scalable concurrency support.
LMDB An extraordinarily fast, memory-efficient database. With memory-mapped files, it has the read performance of a pure in-memory database while retaining the persistence of standard disk-based databases.
LZ4 A lossless data compression algorithm that is focused on compression and decompression speed.
ODBC A C programming language interface that makes it possible for applications to access data from a variety of database management systems (DBMSs).
Remotery A realtime CPU/GPU profiler hosted in a single C file with a viewer that runs in a web browser.
rpmalloc A public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C.
xxHash An Extremely fast Hash algorithm, running at RAM speed limits.
Zstandard (zstd) A fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios.

Use of a binding is subject to the terms of the corresponding license.

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

lwjgl3 open issues Ask a question     (View All Issues)
  • about 2 years Including the native jar-files of LWJGL 3.1.0 in Eclipse
  • about 2 years LWJGL's download options
  • over 2 years FFmpeg bindings
  • over 2 years Play video with LWJGL
  • over 2 years LWJGL3 ARM?
  • over 2 years Screen won't render anything (LWJGL 3.0.0 build 90)
  • over 2 years SVG parsing
  • over 2 years Centralized examples/starters module
  • over 2 years Command Line Interface (cli) starter app
  • over 2 years LWJGL3 Starter Kit
  • almost 3 years SDL2 Binding?
  • almost 3 years Generator non-kotlin Templates
  • almost 3 years Generator requires generator and template source
  • almost 3 years Add Oculus Platform SDK bindings
  • almost 3 years Add AMD Compress bindings
  • almost 3 years Separation of documentation from the main generator
  • almost 3 years Nightly build does not include 32 bit linux native .so files
  • almost 3 years Add bindings for OpenVR, Valve's VR library - Allows support for more HMDs and platforms
  • almost 3 years VM crash on jenkins build server
  • almost 3 years Impossible to munge only core GL entries into single class.
  • almost 3 years X Error of failed request: RenderBadPicture (invalid Picture parameter)
  • almost 3 years Bindings to the SPIR-V Tools
  • about 3 years PhysX bindings
  • about 3 years Binding for the CUDA Runtime Library (cudart)
  • about 3 years Revised SWT GLCanvas implementation
  • over 3 years Add a GUI solution to LWJGL
  • over 3 years Add hwloc bindings
  • over 3 years [Javadoc] Add links to reference pages for Khronos APIs
  • over 3 years Linux framebuffer bindings
  • over 3 years glslang bindings?
lwjgl3 open pull requests (View All Pulls)
  • First HWLOC Additions
  • Integrate the const modifier into the type system
  • That's done it
lwjgl3 questions on Stackoverflow (View All Questions)
  • How to render to jframe with lwjgl3?
  • LWJGL3 OpenGL Triangle wont draw
  • LWJGL3 and Antons OpengGL Tutorials, simple triangle is not displayed
  • LWJGL3 Textured Models Render with No Red
  • LWJGL3 shader, triangle not showing up
  • Making a triangle rotate in LWJGL3 with keycallback
  • LWJGL3 'working' demo throws 'no OpenGL context current in the current thread' exception
  • WaveData LWJGL3
  • Cannot Create VAO in LWJGL3
  • Rendering Bitmap fonts with LWJGL3 and OpenGL
  • Display LWJGL3 in swing window
  • LWJGL3 How to go fullscreen?
  • OpenGL LWJGL3 object in scene will not rotate
lwjgl3 list of languages used
lwjgl3 latest release notes
3.1.6 LWJGL 3.1.6

Changes since 3.1.5:

Bindings

  • bgfx: Updated to API version 60 (up from 55)
  • glfw: Updated to pre-release 3.3.0 version (up from 3.3.0 pre-release):
    • Support for lock key modifiers (GLFW_LOCK_KEY_MODS input mode, GLFW_MOD_CAPS_LOCK, GLFW_MOD_NUM_LOCK)
    • Support for string window hints (glfwWindowHintString, GLFW_COCOA_FRAME_NAME, GLFW_X11_CLASS_NAME, GLFW_X11_INSTANCE_NAME)
    • Support monitor & joystick user ponters (glfwSetMonitorUserPointer, glfwGetMonitorUserPointer, glfwSetJoystickUserPointer, glfwGetJoystickUserPointer)
    • Support for window content scale callbacks (glfwSetWindowContentScaleCallback)
    • Support for cursor hover tests (GLFW_HOVERED)
  • lz4: Update to 1.8.1 (up from 1.8.0)
  • Nuklear: Update to 3.00.2 (up from 2.00.4)
  • OpenVR: Updated to 1.0.12 (up from 1.0.10)
  • rpmalloc: Updated to 1.2.2 (up from 1.2.0)
  • stb
    • Updated stb_dxt to 1.08b (up from 1.0.7)
    • Updated stb_image to 2.18 (up from 2.16)
    • Updated stb_image_write to 1.08 (up from 1.07)
      • STBIW_ZLIB_COMPRESS can be overridden at runtime with stbi_zlib_compress.
    • Updated stb_truetype to 1.18 (up from 1.17)
    • Updated stb_vorbis to 1.13b (up from 1.11)
  • tinyfiledialogs: Updated to 3.2.9 (up from 3.2.4)
  • Vulkan: Updated to 1.0.68 (up from 1.0.65)
  • xxhash: Updated to 0.6.4 (up from 0.6.3)
  • Zstd: Updated to 1.3.4 (up from 1.3.2)
  • Yoga: Updated to 1.9.0 (up from 1.7.0)

Improvements

  • Added JSR-305 nullability annotations to the core and all bindings. (#344)
    • Enables static analysis tools (FindBugs, IDEs) to detect accesses that could cause NullPointerException. Eliminating those improves the quality of LWJGL applications.
    • Enables better interopation with JVM-based languages that feature built-in null-safety. For example, see Kotlin's JSR-305 support.
  • Added Configuration setting to disable function lookup checks.
  • lmdb: Databases are now binary compatible across 32 & 64-bit architectures. (#364)
    • MDB_VL32 is enabled on 32-bit builds.
  • par_shapes: Patched to support 32-bit indices and extremely dense meshes.
  • stb_truetype: Exposed members of internal structures for advanced glyph packing customization. (#358)
  • Tootle: Now supports the Direct3D rasterizer for overdraw optimization.

Fixes

  • JPMS: A natives module now requires transitive the corresponding Java module, instead of the opposite. (#334)
    • Enables loading shared libraries from non-modular paths/JARs.
  • JPMS: module-info files have been moved under META-INF/version/9/ (#334)
    • All LWJGL artifacts are now multi-release JAR files to avoid trouble with older tools that are not compatible with Java 9.
  • JPMS: Added appropriate requires static declarations to satisfy optional binding interop dependencies. (#369)
  • Fixed broken javadoc links in all bindings. Also updated URLs to avoid redirects.
  • bgfx: Restored default API thread encoder functions, that were erroneously removed in 3.1.4.
  • LibOVR: Fixed ovr_TraceMessage signature.
  • OpenAL: Fixed capability name of the AL_SOFT_source_resampler extension.
  • Tootle: Fixed pnClusterRemapOut parameter validation.

Breaking Changes

  • Several methods that previously accepted null/NULL and returned null, now require non-null input.
    • Applies to: struct & callback creation methods and memByteBuffer/memUTF8/stack.UTF8/etc.
    • Added corresponding methods with the Safe suffix that accept null/NULL, matching the old behavior.
    • With this change the common case (non-null input) requires no code changes and is warning/error-free. The uncommon case (null input) is recognizable (the suffix) and must be handled properly to eliminate warnings/errors.
  • Allocation methods that returned null/NULL on allocation failure, now throw OutOfMemoryError instead. This matches the behavior of ByteBuffer.allocateDirect.
    • Applies to: struct allocation methods and memAlloc/memCalloc/etc.
    • Does not apply to allocations via direct binding calls (e.g. LibCStdlib.malloc).
  • Getters of struct members that should never be NULL, throw NullPointerException instead of returning null when the struct instance is not initialized.
    • Use Struct::isNull to test pointer members of untrusted struct instances.
  • bgfx: Restored native mapping of bgfx_init(_vendorId) and bgfx_update_texture_cube(_side) parameters. (#368)
  • bgfx: uint16_t bitfield constants are now mapped to int. (#368)
  • glfw: glfwInitHintString has been renamed to glfwWindowHintString.
  • lmdb: Databases developed on 32-bit architectures must be recreated. (#364)
  • par_shapes: Changed par_shapes_mesh::triangles from uint16_t/ShortBuffer to uint32_t/IntBuffer.
  • stb_rect_pack: stbrp_rect::was_packed is now mapped to Java boolean.
3.1.5 LWJGL 3.1.5

Changes since 3.1.4:

Bindings

  • Added AMD Tootle bindings.
    • Only the software rasterizer is supported.

Fixes

  • Fixed various javadoc links.
  • par: Parsing of floating point values in L-systems is now locale-insensitive.
  • stb: Fixed buffer checks to account for row stride, when specified.
  • Generator: Fixed auto-size transformations by non-constant expressions.

Breaking Changes

  • Removed array overloads from the LZ4 & ODBC bindings.
    • They were added by mistake in LWJGL 3.1.4.
3.1.4 LWJGL 3.1.4

Changes since 3.1.3:

Bindings

  • Added LZ4 bindings.
  • Added NanoSVG to the existing NanoVG bindings.
  • Added ODBC bindings.
  • Added Remotery bindings.
  • Added Zstandard bindings.
  • bgfx: Updated to API version 55 (up from 48)
  • glfw: Updated to pre-release 3.3.0 version (up from 3.3.0 pre-release):
    • Support for transparent window framebuffers (GLFW_TRANSPARENT_FRAMEBUFFER window hint)
    • Support for whole window opacity (glfwGetWindowOpacity and glfwSetWindowOpacity)
    • Support for content scale queries (glfwGetMonitorContentScale and glfwGetWindowContentScale)
    • Linux: Added support for the experimental Wayland backend. Enable with -Dorg.lwjgl.glfw.libname=glfw_wayland.
  • LibOVR: Updated to 1.20.0 (up from 1.18.0)
  • Nuklear: Updated to 2.00.4 (up from 2.00.2)
  • tinyfiledialogs: Updated to 3.2.4 (up from 3.0.5)
  • Vulkan: Updated to 1.0.65 (up from 1.0.61)
  • Yoga: Updated to 1.7.0 (up from 1.6.0)

Improvements

  • Replaced Automatic-Module-Name with explicit JPMS modules.
    • Enables applications using LWJGL to be bundled in custom run-time images with the jlink tool.
  • lmdb: Significantly improved incremental growth performance on Windows.
    • Granularity of mapped memory commits increased from 4KB (page size) to 2MB.
    • This is an unofficial patch of ITS#8324.

Fixes

  • EGL: Fixed nullability of eglMakeCurrent arguments.
  • OpenVR: Fixed mapping of Vulkan forward declarations.
  • Fixed native library resource discovery when running LWJGL as JPMS modules.
  • Fixed invalid size calculation in <StructType>.malloc(capacity) methods.
  • Fixed MemoryStack debugging when a try-with-resources block does not inline the call to AutoCloseable::close.
    • Supports Java 9 try-with-resources, which generates a synthetic $closeResource method.
    • Supports Kotlin's T.use, which uses the kotlin.AutoCloseable::closeFinally extension function.
  • Fixed build number lookup from the jar manifest.
More projects by LWJGL View all
Other projects in Kotlin