Website & JavaDoc | Vulkan Tutorial port | LearnOpenGL port | Examples | Discord
This project is heavily inspired by the vulkanalia crate.
vulkan4j is a series of graphics and relevant API binding for Java, implemented with Java 22 Project Panama java.lang.foreign APIs. This project initially focuses on Vulkan, but soon we expanded to other graphics APIs such as OpenGL and OpenGL ES. More APIs will be added in the future, feature requests and contributions are welcome!
- Vulkan (
vulkanmodule): Generated fromvk.xmlandvideo.xml. - Vulkan Memory Allocator (
vmamodule): Generated fromvk_mem_alloc.h. If you use a specific build supportingvk4jSetJavaTrace, you can enjoy Java stacktrace on VMA assertion failures. Check out thevma_builddirectory for more information. - OpenGL (
openglmodule): Generated fromgl.xml. Our supported extension list is copied from LWJGL, and not all extensions are included (since some OpenGL extensions are completely useless nowadays). Name your desired extension in the issue tracker! - OpenAL (
openalmodule): Generated from OpenAL-soft header files. This module is based on OpenAL-soft 1.2, and provides a complete set of OpenAL features, including all extensions supported by OpenAL-soft. - GLFW (
glfwmodule): Generated from GLFW header files. - libshaderc (
shadercmodule): Generated fromlibshadercheader files. This module also provides a usefulShadercUtilclass to assist you with including files.
- SDL3 (
sdl3module): Generated from SDL3 header files. This module is still under development, it has unimplemented functionalities, and may contain bugs. Issues and pull requests are welcome.
Obsolete bindings
- OpenGL ES 2.0 only (
gles2module): Also generated fromgl.xml. This module only provides most fundamental OpenGL ES 2.0 features, and does not include any extensions. This package was initially created for the Chuigda's own use. This package will still get maintained since Chuigda wants.
To improve development experience using Java 22 FFM APIs, we created a small library ffm-plus that encapsulates most commonly used facilities, such as typed pointers and bitfield operations. All our bindings use ffm-plus.
Our website itself is generated with JavaDoc, with a custom overview.html.
For users new to Vulkan, there is a (almost) complete adaptation of https://vulkan-tutorial.com by Alexander Overvoorde to use Java and vulkan4j instead of C++. The published version of this tutorial can be found here, and the sources for the tutorial (including standalone working code examples for each chapter) can be found under the tutorial directory.
For OpenGL users, we ported the LearnOpenGL tutorial to use Java and vulkan4j. The published version of this tutorial can be found here, and the sources for the tutorial can be found under the tutorial directory. Till now only the first several chapters are ported, which should be adequate to get you started with OpenGL in Java. The rest of the chapters will be ported in the future.
We provide a set of examples, which can be found under the example directory. These examples are intended to demonstrate how to use the bindings in practice, and can be used as a reference for your own projects.
- v0.3.0 rewrite, new namespace, new
ffm-plusmodule, usecodegen-v2module for all registry extraction and code generation. - API enhancements: chaining
setmethods for structures, LWJGL stylesetmethods for structure members,allocateVandwriteVseries functions forPtrtypes. - Full OpenGL bindings
- Tutorial porting
- OpenAL bindings
- WebGPU bindings
- Full OpenGL ES bindings
- SDL3 bindings
- LLVM bindings (is this graphics anymore?)
See vulkan4j-legacy.
Doki Doki 7th Design Club! is not accepting any donation at the moment though Chuigda thinks that the whole world owes him 27 billion 30 million CHF. If you like this project, either using in production or got some inspiration, just star and thank author.