When I discovered that fogleman/gg — the beloved 2D graphics library for Go — hadn't been updated since 2019, I knew the Go community needed a successor. Today, I'm excited to announce gogpu/gg v0.9.0 — a modern, GPU-accelerated 2D graphics library inspired by fogleman/gg.
The Journey
It all started with a Reddit discussion about the state of graphics and GUI development in Go. The community's frustration was clear: Go deserves better graphics support.
So we built it.
What is gogpu/gg?
gogpu/gg is a Pure Go 2D graphics library designed for:
- IDEs (GoLand, VS Code level performance)
- Browsers (Chrome-level rendering)
- Professional graphics applications
Key Features
| Feature | Description |
|---|---|
| Similar API | Easy migration from fogleman/gg |
| Pure Go | Zero CGO, simple go build
|
| GPU Acceleration | WebGPU via Sparse Strips algorithm |
| Scene Graph | Retained mode rendering |
| 29 Blend Modes | Porter-Duff + Advanced + HSL |
| Parallel Rendering | TileGrid + WorkerPool |
| LUT Optimizations | 260x faster sRGB conversions |
Quick Start
package main
import (
"github.com/gogpu/gg"
"github.com/gogpu/gg/text"
)
func main() {
ctx := gg.NewContext(512, 512)
ctx.ClearWithColor(gg.White)
// Draw shapes
ctx.SetColor(gg.Hex("#3498db"))
ctx.DrawCircle(256, 256, 100)
ctx.Fill()
// Load font and draw text
source, _ := text.NewFontSourceFromFile("arial.ttf")
defer source.Close()
ctx.SetFont(source.Face(32))
ctx.SetColor(gg.Black)
ctx.DrawString("Hello, GoGPU!", 180, 260)
ctx.SavePNG("output.png")
}
Architecture: Sparse Strips
The v0.9.0 release introduces GPU acceleration using the Sparse Strips algorithm — the same approach used by vello in 2025:
Path → CPU Tessellation → Strips → GPU Rasterization → Compositing
- CPU handles complex path math (curves, intersections)
- GPU handles parallel pixel processing
- Minimal data transfer (strips are compact)
The GoGPU Ecosystem
gogpu/gg is part of a larger Pure Go GPU Computing Ecosystem:
| Project | Description | Version | LOC |
|---|---|---|---|
| gogpu/gg | 2D graphics library | v0.9.0 | ~61K |
| gogpu/gogpu | Graphics framework | v0.3.0 | ~9K |
| gogpu/wgpu | Pure Go WebGPU | v0.4.0 | ~58K |
| gogpu/naga | Shader compiler (WGSL→SPIR-V) | v0.4.0 | ~16K |
Total: ~144K lines of Pure Go — no CGO, no Rust, no C.
wgpu Backends
The Pure Go WebGPU implementation supports multiple backends:
| Backend | Status | Use Case |
|---|---|---|
| Vulkan | ✅ Done | Cross-platform (Windows/Linux/macOS) |
| OpenGL ES | ✅ Done | Windows + Linux |
| Software | ✅ Done | Headless, CI/CD, no GPU required |
| Metal | Planned | macOS/iOS |
| DX12 | Planned | Windows |
Version History
| Version | Milestone |
|---|---|
| v0.1.0 | Canvas API, shapes, paths |
| v0.2.0 | Text rendering (FontSource/Face) |
| v0.3.0 | Images, clipping, compositing |
| v0.4.0 | Color pipeline, layer API |
| v0.5.0 | LUT optimization (260x faster sRGB) |
| v0.6.0 | Parallel rendering |
| v0.7.0 | Scene graph (retained mode) |
| v0.8.0 | Backend abstraction |
| v0.9.0 | GPU acceleration |
What's Next?
- v0.10.0: GPU text rendering (glyph atlas, SDF fonts)
- v1.0.0: Production release with stable API
Acknowledgments
Special thanks to:
- @fogleman for the original gg that inspired this project
- The vello team for Sparse Strips research
- The Go community on r/golang
Links
- GitHub: https://github.com/gogpu/gg
- GoGPU Organization: https://github.com/gogpu
- Community Discussion: https://github.com/fogleman/gg/issues/208
Star the repo if you find it useful! Contributions welcome.
go get github.com/gogpu/gg
Top comments (0)