A cross-platform 3D/2D rendering engine written in Rust using OpenGL / OpenGL ES through glow.
The goal of this project is to build a lightweight, modular, and flexible rendering library crate (rendering_engine) that runs seamlessly across desktop and mobile while utilizing modern rendering techniques (Multi-Draw Indirect, persistent mapped buffers, multi-threaded rendering, texture management, FBOs, compute shaders, and skybox passes).
-
Modular Architecture (
core,resources,render)- Clean separation between low-level memory/buffers, graphics resources, and rendering pipelines.
-
Indirect Draw Batching
- Groups instances by material and mesh and submits indirect draw commands.
- The current
glowpath dispatches those commands with a GL-call loop; the buffer layout is ready for native MDI when the backend exposes it. - Uses GPU-side instance data handling to avoid unnecessary CPU-to-GPU synchronization.
-
Textures, Atlases & Texture Arrays
- 2D, cubemap, and array textures; sRGB and BC1/BC4/BC5 uploads; CPU RGBA8 atlas packing and UV helpers.
-
Offscreen Framebuffers & Render Targets
- FBO abstractions (
Framebuffer) with color attachments, depth textures, and depth renderbuffers.
- FBO abstractions (
-
Compute Shader Pipelines
ComputeShadersupport for OpenGL ES 3.1+ / OpenGL 4.3+.
-
Fullscreen Skybox Pass
- Pre-pass skybox pipeline with
LEQUALdepth testing and inverse view-projection uniform upload.
- Pre-pass skybox pipeline with
-
Dedicated Screen-Space UI
- Pixel-coordinate draw list with its own shader and buffers, separate from scene meshes and camera transforms.
-
Light Uniform Block
- Renderer-managed std140 UBO for up to 16 directional, point, or spot lights.
- Shaders opt into the shared block layout; the demo uses it for diffuse lighting.
-
Persistent Mapped Buffers
- Uses persistent mapped SSBOs with multiple fenced regions (
TRANSFORM_REGIONS) to safely update GPU data while avoiding CPU/GPU conflicts.
- Uses persistent mapped SSBOs with multiple fenced regions (
-
Dedicated Render Thread & Triple-Buffer Handoff
- Game logic and rendering exchange the latest frame through clone-free slot swaps. The GL context and
Rendererare created and used only on the render thread.
- Game logic and rendering exchange the latest frame through clone-free slot swaps. The GL context and
-
Frame Diagnostics
- Per-frame counts for submitted and culled instances, draw calls, pipeline changes, and estimated triangles.
-
Desktop and Android Support
- Desktop support through
winit/glutin. - Android support through
android-native-activityand OpenGL ES.
- Desktop support through
rendering-engine/
├── engine/ # Core rendering engine crate (`rendering_engine`)
│ └── src/
│ ├── lib.rs
│ ├── core/ # Memory allocators, persistent buffers, math & triple buffer
│ ├── render/ # Rendering APIs, frame data, passes, scene graph
│ │ └── renderer/ # Scene API, resources, passes, sync, world and draw submission
│ ├── resources/ # GPU resources and resource managers
│ │ ├── shader/ # Shader program and manager
│ │ └── texture/ # Texture formats, atlas, and manager
│
├── demo/ # Animated Ava model application
│ └── src/
│
├── docs/ # Library documentation & guides
│ └── USAGE.md # Simple, comprehensive library usage guide
│
└── shaders_gles/ # OpenGL / OpenGL ES shader sources
For code examples on using rendering_engine as a library crate in your own projects, see Library Usage Guide.
To launch the desktop demo application:
cargo run --bin desktop- Left drag: orbit the camera.
- Right drag: pan the camera.
- Mouse wheel: zoom.
- F: fit the model in view.
- Space: pause or resume animation.
- R: restart the current clip.
- 1–9: select an animation clip.
- E: toggle vertical sync.
- G: toggle wireframe.
The demo loads models/Ava.glb, displays its scene hierarchy and PBR base
color, and plays its skeletal animation through the engine's normal mesh,
material, frame handoff, lighting, and rendering paths. cargo run -p demo --bin desktop -- --inspect-model parses Ava and prints mesh, skin, and clip
details without opening a window. See Asset pipeline notes
for implemented formats and current limits.
This project is open-source and available under the BSD-3-Clause License.