Projects / 02
ovg
Odin vector graphics. A 2D vector canvas that started as a port of femtovg (the nanovg lineage) and grew well beyond it.
- Odin
- MIT
- software rasterizer
- SDL_GPU · Vulkan / Metal / D3D12
- oglyph + ocurves + oicut + Odin vendor
By the numbers
- of the resvg test suite
- 88.5%
- 1037 files; the curated 53 all pass
- GPU vs software parity
- 1–2/255
- every parity scene, RX 9070 XT, Vulkan (RADV)
- shaping differences from HarfBuzz
- 0
- 104,545 cases over oglyph's corpora, 40 downloaded fonts included
- CSS blend modes
- 16
- plus patterns, masks and clip paths
Figures from the ovg README (tools/svg_suite, tools/sdlgpu_parity); shaping from oglyph v0.0.5's tools/shape_corpus against libharfbuzz 14.6.0, re-run 2026-10-24.
What's in it
01The femtovg core
Paths, strokes, gradients, image paints, scissoring, compositing, render-to-image and antialiased fills, recorded as commands for a backend.
02Layers
Group opacity, clip paths, alpha and luminance masks, 16 blend modes and patterns, each sized to its content.
03SVG filters
Blur, drop shadow, offset, flood, composite, merge, blend and colour matrix, with filter regions and linearRGB.
04SVG import
svg_parse / svg_draw with CSS styling, <use>, gradients, patterns, masks, filters and text, plus per-element overrides for animation.
05Lottie import
After Effects (Bodymovin) animations: precomps, mattes, masks, trim paths and eased keyframes.
06Real text and vector art
OpenType shaping by oglyph, HarfBuzz's rules in native Odin (ligatures, kerning, mark positioning, Arabic, Indic and the other complex scripts), bidi, variable fonts at a chosen instance, per-glyph font fallback and multi-style layout. Every glyph, fill and stroke is drawn on the GPU by the exact area of each pixel its curves cover, computed by ocurves, under any transform: one instanced draw per run, no tessellation.
07Dashes
Dash arrays, offsets and pathLength, enough to draw shapes on stroke by stroke.
08Custom shaders
Register compiled SkSL (from oksl) and run it as a layer, with image, video or group children.
09Record anywhere, play on the GPU
A recording canvas builds a frame's commands on any thread; the GPU thread plays them back, so frames build in parallel.
Two backends, one picture
The software backend is the pixel reference. It evaluates the fragment shader's formulas, computes the same exact coverage and samples textures exactly like the GPU, so the SDL_GPU backend (Vulkan on Linux, Metal on macOS) can be diffed against it scene by scene. ovg reads fonts and shapes text through oglyph, computes coverage and path booleans through ocurves, and decodes images (and writes PNGs) through oicut; the only other dependency is SDL3, from Odin's own vendor packages, for the GPU path.
Use it
import vg "deps:ovg" // -collection:deps=.. (the directory holding ovg, oglyph, ocurves and oicut)
import image "deps:oicut/image"
sw: vg.Software_Backend
vg.software_backend_init(&sw)
c: vg.Canvas
vg.canvas_init(&c, vg.software_backend(&sw))
vg.set_size(&c, 640, 360)
vg.clear_rect(&c, 0, 0, 640, 360, vg.WHITE)
p: vg.Path
vg.path_rounded_rect(&p, 40, 40, 200, 120, 16)
vg.fill_path(&c, &p, vg.paint_linear_gradient(40, 40, 240, 160, vg.rgb(255, 80, 0), vg.rgb(0, 60, 255)))
stroke := vg.paint_color(vg.BLACK)
stroke.stroke.line_width = 3
vg.stroke_path(&c, &p, stroke)
vg.flush(&c)
image.write_png("out.png", sw.pixels, int(sw.width), int(sw.height))import vgsdl "ovg/sdlgpu"
gpu: vgsdl.SDL_Backend
vgsdl.init(&gpu) // own headless device (or pass the host's)
c: vg.Canvas
vg.canvas_init(&c, vgsdl.backend(&gpu))
// ... draw ...
vg.flush(&c) // renders into the backend's offscreen texture
shot, _ := vg.screenshot(&c) // RGBA8, top-downThe family
- ocurves
Curve geometry: exact pixel coverage, and booleans that keep their curves
- ovg
2D vector graphics: paths, SVG, Lottie, text, filters
- oglyph
Fonts and OpenType text shaping, checked against HarfBuzz
- oicut
Video, audio and image codecs with no FFmpeg
- oksl
SkSL and Shadertoy shaders to SPIR-V, MSL and CPU
- o3d
3D in three.js terms, on the GPU or the CPU
- ottis
Text to speech with a time for every word
- odawg
Music from songs as data: synths, sampled instruments, an 808, a 909 and a 303, mixed and mastered
- onimite
Videos from Lua scripts, written by you or your coding agent