Join the Discussion: Help shape the future of Go graphics! Share your ideas, report issues, and discuss features at our GitHub Discussions.
Update (December 25, 2025): Major Milestone! GoGPU v0.8.0 completes Metal backend with WGSL→MSL shader compilation. naga v0.6.0 adds GLSL output (OpenGL 3.3+, ES 3.0+). 214K lines of Pure Go — production-ready for Windows, Linux, macOS.
Finally, a graphics framework that feels like Go.
TL;DR
- Problem: Go lacks a professional graphics library
- Solution: GoGPU — Pure Go, Zero-CGO, WebGPU-based
- Result: 214K lines of Pure Go code, no Rust, no C
- NEW: Metal backend complete, GLSL shader output!
- Repo: github.com/gogpu/gogpu
- Discussion: Join the conversation
The Ecosystem (December 2025)
What started as a simple triangle demo has grown into a complete graphics stack:
| Project | Description | Version | LOC |
|---|---|---|---|
| gogpu/gg | 2D graphics library | v0.14.0 | ~95K |
| gogpu/wgpu | Pure Go WebGPU | v0.7.0 | ~71K |
| gogpu/gogpu | Graphics framework | v0.8.0 | ~26K |
| gogpu/naga | Shader compiler (WGSL → SPIR-V/MSL/GLSL) | v0.6.0 | ~23K |
| gogpu/ui | GUI widget toolkit | Planning | — |
Total: ~214K lines of Pure Go — no CGO, no Rust, no C.
What's New in v0.8.0
Metal Backend Complete (macOS)
The Pure Go Metal backend now includes:
- Full
Present()implementation with swapchain - WGSL → MSL shader compilation via naga
- Complete
CreateRenderPipeline()with vertex/fragment functions - Zero-dimension window guard for minimized windows
// Works on macOS with Metal!
app := gogpu.NewApp(gogpu.DefaultConfig())
app.Run() // Automatically uses Metal on macOS
GLSL Shader Output (naga v0.6.0)
naga now compiles WGSL to three backends:
| Target | Platforms | Status |
|---|---|---|
| SPIR-V | Vulkan (all platforms) | Stable |
| MSL | Metal (macOS/iOS) | Stable |
| GLSL | OpenGL 3.3+, ES 3.0+ | NEW! |
// Compile WGSL to GLSL
glslCode, _ := glsl.Compile(module, glsl.Options{
Version: glsl.Version330,
})
This opens integration with:
- soypat/gsdf (CAD with compute shaders)
- OpenGL ES embedded devices
- WebGL via transpilation
2D Graphics Enhancements (gg v0.14.0)
The 2D graphics library now includes:
- Alpha Mask System — Compositing masks for advanced effects
- Fluent PathBuilder — Method chaining for path construction
-
Streaming I/O —
EncodePNG(w io.Writer)for any output -
Resource Cleanup —
Context.Close()implementsio.Closer
// Fluent path building in v0.14.0
path := gg.BuildPath().
Circle(100, 100, 50).
Star(200, 100, 40, 20, 5).
Build()
Platform Support
| Platform | Windowing | GPU Backend | Status |
|---|---|---|---|
| Windows | Win32 | Vulkan, GLES | Production |
| Linux X11 | X11 | Vulkan, GLES | Production |
| Linux Wayland | Wayland | Vulkan, GLES | Production |
| macOS | Cocoa | Metal | Production (v0.8.0) |
All major desktop platforms fully supported!
Pure Go WebGPU Backends
| Backend | Status | Use Case |
|---|---|---|
| Vulkan | Done | Cross-platform (Windows/Linux/macOS) |
| Metal | Done | macOS/iOS |
| OpenGL ES | Done | Windows + Linux |
| Software | Done | Headless, CI/CD |
| DX12 | Planned | Windows native |
The Problem: Go and Graphics Don't Mix (Until Now)
If you've ever tried graphics programming in Go, you know the pain:
- CGO hell — Most libraries require a C compiler
- Abandoned projects — Promising repos with no updates since 2019+
- "Just use Rust/C++" — The default answer in every forum
I saw this frustration firsthand in a Reddit thread: "Go deserves more support in GUI development".
So I built it.
Show Me the Code
High-Level: 2D Graphics (gogpu/gg)
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")
}
Low-Level: Triangle (gogpu/gogpu)
package main
import (
"log"
"github.com/gogpu/gogpu"
"github.com/gogpu/gogpu/gmath"
)
func main() {
app := gogpu.NewApp(gogpu.DefaultConfig().
WithTitle("GoGPU Triangle").
WithSize(800, 600))
app.OnDraw(func(ctx *gogpu.Context) {
ctx.DrawTriangleColor(gmath.DarkGray)
})
if err := app.Run(); err != nil {
log.Fatal(err)
}
}
15 lines vs 400-500 lines of raw WebGPU boilerplate.
Architecture
┌─────────────────────────────────────────┐
│ Your Application │
├─────────────────────────────────────────┤
│ gogpu/ui (GUI Toolkit) │
│ Widgets, Layouts │ ← In Planning
├─────────────────────────────────────────┤
│ gogpu/gg (2D Graphics API) │
│ Scene Graph, Blend Modes, Layers │
├─────────────────────────────────────────┤
│ gogpu/gogpu (Framework) │
│ Windowing, Input, Lifecycle │
│ Win32 │ X11 │ Wayland │ Cocoa │
├─────────────────────────────────────────┤
│ gogpu/wgpu (Pure Go WebGPU) │
│ Vulkan │ Metal │ OpenGL ES │ Software │
├─────────────────────────────────────────┤
│ gogpu/naga (Shader Compiler) │
│ WGSL → SPIR-V │ MSL │ GLSL │
└─────────────────────────────────────────┘
Key innovation: Everything is Pure Go. No CGO, no wgpu-native dependency.
GUI Toolkit: gogpu/ui (In Planning)
We're designing an enterprise-grade GUI toolkit for Go:
- Signals-based reactivity (like Angular/SolidJS)
- Tailwind-style API for styling
- Enterprise features: docking, virtualization, accessibility
- Cross-platform: Same code for Desktop, Web (WASM), Mobile
Want to help shape the API? Join the discussion:
Series
This is part of a series documenting the GoGPU journey:
- GoGPU: A Pure Go Graphics Library for GPU Programming <- You are here
- GoGPU: From Idea to 100K Lines in Two Weeks
- Building a Shader Compiler in Pure Go: naga Reaches v0.4.0
- Pure Go 2D Graphics Library with GPU Acceleration: Introducing gogpu/gg
Current Status
Ecosystem: 214K lines of Pure Go
Platforms: Windows │ Linux (X11 + Wayland) │ macOS
Backends: Vulkan │ Metal │ OpenGL ES │ Software
Shaders: WGSL → SPIR-V │ MSL │ GLSL
UI: Architecture validated, awaiting community feedback
Phase: RAPID DEVELOPMENT — API not frozen, contributions welcome!
What works:
- Complete 2D graphics API (gogpu/gg v0.14.0)
- GPU acceleration via Sparse Strips
- Pure Go WebGPU (no wgpu-native required)
- Shader compilation (WGSL → SPIR-V, MSL, GLSL)
- Windows Win32 windowing
- Linux X11 windowing (Pure Go!)
- Linux Wayland windowing (Pure Go!)
- macOS Cocoa windowing (Pure Go!)
- Metal GPU backend (Complete!)
- Scene graph with retained mode rendering
- 29 blend modes (Porter-Duff + Advanced + HSL)
- Layers with per-layer opacity
- Alpha masks for compositing (v0.14.0)
What's Next?
- v1.0.0: Production release with stable API
- GUI toolkit: gogpu/ui — signals, widgets, themes
- Optimization passes: Dead code elimination, constant folding for naga
- DX12 backend: Windows native GPU (future)
- Performance: SIMD optimization for 2D rendering
Join Us Now — While You Can Shape the Future
This is the perfect time to get involved.
We're in a rapid development phase where the API is still evolving. This means:
- Your ideas matter — Share in Discussions
- Your feedback shapes the API — Before v1.0.0 freezes the interface
- Cross-platform testers needed — Help us validate on real hardware
- Your name in history — Be part of building Go's GPU ecosystem
Once we hit v1.0.0, the API freezes. Now is your window.
How You Can Help
Test on Your Platform
# Clone and build
git clone https://github.com/gogpu/gogpu
cd gogpu
go build -tags purego ./examples/triangle/
./triangle
Report issues at github.com/gogpu/gogpu/issues
Discuss Features
Join the conversation about UI toolkit design:
Star the Repos
- gogpu/gogpu — Framework
- gogpu/gg — 2D Graphics
- gogpu/wgpu — Pure Go WebGPU
- gogpu/naga — Shader Compiler
- gogpu/ui — GUI Toolkit
Contribute Code
PRs welcome! Especially needed:
- Cross-platform testing (Windows, Linux X11/Wayland, macOS)
- UI toolkit development (signals, widgets, layouts)
- DX12 backend
- Documentation
- Real-world usage examples
Links
- Organization: github.com/gogpu
- Discussion: Join the conversation
- v0.8.0 Release: gogpu/gogpu v0.8.0
- gg v0.14.0 Release: gogpu/gg v0.14.0
- wgpu v0.7.0 Release: gogpu/wgpu v0.7.0
- naga v0.6.0 Release: gogpu/naga v0.6.0
Go deserves a great graphics library. We're building it.
Questions? Drop them in the comments or join the discussion.
Top comments (4)
As soon as Text Rendering is available, I will be using this as the rendering engine for Bellina (a GUI library in Go).
Thanks for your comment. Try github.com/gogpu/gg and the text rendering should work. There might be some bugs, but I've only tested it so far.
I'm also been working on a experimental GUI library, currently using raylib because I don't know GPU programming, how hard would it be to use gogpu compared to raylib? Raylib is great but it redraws everything and my library is meant to be a retained mode gui, I want to redraw only the updated regions to keep GPU usage low. reddit.com/r/raylib/comments/1puyi...
Hi ANDRES36! Great to hear about your GUI library project!
Your approach with raylib is interesting. Here's a quick comparison:
What gogpu/gg offers for GUI building (v0.14.0):
gogpu/ui (in planning):
We're designing a signals-based GUI toolkit on top of gogpu/gg. Think Angular/SolidJS reactivity but for native desktop apps. Enterprise features like docking, virtualization, accessibility are planned.
Your HTML/CSS reverse-engineering approach is clever! If you're interested in comparing notes or potentially collaborating on retained-mode patterns, join our discussion:
👉 github.com/orgs/gogpu/discussions/18
The Pure Go ecosystem means easy cross-compilation:
GOOS=linux go build— no C toolchain needed.