Hi everyone, I'm excited to share a massive passion project I've been refining: micro-gl (and its sister libraries). I needed a lightweight vector graphics engine for constrained environments while wanting absolute control over memory and types. This journey took me down a 6-month rabbit hole.
Core Architecture: Zero Standard Library (std::)
No hidden allocations. To support this, I spent an intense 3 weeks writing my own standalone container library (micro-containers) featuring AVL trees, an array-backed LRU pool, and a linear-probing hash map sized entirely at compile time via templates.
Type-Agnostic Math
The entire rasterizer is templated. It can run on raw float, double, or custom fixed-point integer types (like Q formats) for microcontrollers without an FPU.
Engine Stack
- micro-gl: A CPU-bound rasterizer handling textures, gradients, and Porter-Duff blending.
- micro-tess: A precision-agnostic polygon tessellator.
- nitro-gl: An OpenGL implementation that compiles C++ shader object hierarchies into monolithic GLSL strings at runtime, cached via MurmurHash.
Everything is purely header-only, allocator-aware, and optimized for extreme cache locality. Repositories are open-source here:
- Graphics Engine (CPU): micro-gl
- Graphics Engine (GPU): nitro-gl
- Custom Containers: micro-containers
I would love to hear your thoughts on the template design and compile-time sizing strategies!
Blogger's Review: This project showcases a profound understanding of memory management and performance optimization, particularly in resource-constrained environments, with an impressive application of flexible design principles and template programming.