A lightweight, high-performance 2D Graphics Rendering Library built in C++20 using modern Vulkan.
Axiom encapsulates Vulkan boilerplate into a clean 2D rendering API featuring batching, SDF font rendering, and custom shader pipelines.
Explore the docs »
·
Report Bug
·
Request Feature
Table of Contents
Axiom is a high-performance 2D graphics rendering engine written in C++20 and powered by modern Vulkan. It abstracts away low-level Vulkan verbosity handling device creation, swapchains, command pools, and pipeline state objects under the hood, while exposing a clean, intuitive API for high-level rendering.
Engineered specifically as a lightweight rendering backend for custom UI frameworks, Axiom provides:
- Efficient 2D Batching: High-speed quad, primitive, and textured mesh rendering using single-pass batching.
- SDF Font Rendering: Resolution-independent Signed Distance Field text rendering for crisp UI typography at any zoom level.
- Modular Vulkan RHI: A clean Render Hardware Interface wrapping buffers, textures, framebuffers, and synchronization objects without leaking Vulkan headers into your main project.
- Integrated Shader Compilation: Automatic runtime/build-time GLSL to SPIR-V shader compilation via glslc.
- Standalone Static Library: Packages cleanly into libaxiom.a, allowing downstream projects to link directly against compiled graphics primitives.
To get a local copy of Axiom up and running on your system, follow these steps to install the necessary dependencies, build the static library, and optionally install it system-wide.
Ensure you have a C++20 compliant compiler, CMake, and the Vulkan SDK installed on your system.
- Arch-Based:
sudo pacman -S base-devel cmake vulkan-devel glm stb glfw-x11 glslang
- Fedora:
sudo dnf install gcc-c++ cmake vulkan-headers vulkan-loader-devel glfw-devel glslc
- Debian:
sudo apt update sudo apt install build-essential cmake libvulkan-dev vulkan-tools libglfw3-dev shaderc
- Clone the repository:
git clone https://github.com/Yukari-dev/Axiom.git cd Axiom - Configure the build directory:
mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release ..
- Compile libaxiom.a and the sandbox driver:
make -j$(nproc) - (Optional) Install libaxiom.a and headers system-wide (/usr/local/):
sudo make install
Axiom can be consumed either by linking to the installed system library (libaxiom.a) or by including it directly in your project tree.
Create a folder named src and put all your .cpp files in it, in this example, the following file is not gonna be placed inside src/ and named main.cpp
Here is a minimal setup initializing a window, setting up the Vulkan RHI context, and rendering 2D primitives within a render loop:
#include <axiom.h>
int main() {
// 1. Initialize Window & Vulkan RHI Context
Axiom::Init();
int width = 800;
int height = 600;
Axiom::Window window(width, height, "Axiom Render Loop");
Axiom::RhiContext rhiContext(window.GetHandler(), width, height);
Axiom::Renderer2D renderer(rhiContext);
while (!window.ShouldClose()) {
window.PollEvents();
rhiContext.BeginFrame();
renderer.Begin();
// Draw colored 2D quad (position, size, color)
renderer.DrawRect(
{ 100.0f, 100.0f }, // position
{ 200.0f, 150.0f }, // size
{ 0.2f, 0.8f, 0.4f }// color
);
renderer.End();
rhiContext.EndFrame();
}
Axiom::Shutdown();
return 0;
}
Add Axiom to your downstream application's CMakeLists.txt using find_library:
# Replace ${PROJECT_NAME} with the actual name (e.g. app_project)
cmake_minimum_required(VERSION 3.20)
project(${PROJECT_NAME} VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Vulkan REQUIRED)
find_package(glfw3 REQUIRED)
# 1. Find library strictly in /usr/local/lib
find_library(AXIOM_LIB
NAMES axiom
PATHS /usr/local/lib
NO_DEFAULT_PATH
)
# 2. Find header path strictly in /usr/local/include
find_path(AXIOM_INCLUDE_DIR
NAMES axiom.h
PATHS /usr/local/include
NO_DEFAULT_PATH
)
add_executable(${PROJECT_NAME} src/main.cpp)
# 3. Include subdirectories so axiom.h internal includes resolve
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${AXIOM_INCLUDE_DIR}
${AXIOM_INCLUDE_DIR}/platform
${AXIOM_INCLUDE_DIR}/renderer2d
${AXIOM_INCLUDE_DIR}/rhi
)
target_link_libraries(${PROJECT_NAME} PRIVATE
${AXIOM_LIB}
Vulkan::Vulkan
glfw
)
Make sure you are at the root of the project.
cmake -B build
cmake --build buildTo run the program (replace PROJECT_NAME with the actual name you set in CMakeLists.txt
./build/PROJECT_NAME- Modern Vulkan RHI setup (Instance, Physical/Logical Device, Swapchain, Sync Primitives)
- Single-pass batched 2D quad and shape renderer
- SDF Font loading and text layout engine
- Integrated
glslcSPIR-V shader compilation in CMake - Packaging into a single static library (
libaxiom.a) - Advanced UI clipping rects and stencil masking support
- Multi-threaded command buffer generation for complex UI layouts
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Yukari - yukarii.official@gmail.com
Project Link: https://github.com/Yukari-dev/Axiom
- Khronos Group - For the Vulkan API specifications and GLSL compiler tooling
- GLFW - For lightweight cross-platform window management and input handling
- stb - For single-file C/C++ image and font processing utilities