GoGUI: A Pure-Go, Zero-CGO GUI That Draws Web-Style UI Directly on OpenGL
A pure-Go, zero-cgo desktop GUI means no toolchain lock-in and no runtime dependency; on Windows it yields a single small executable. It also reopens the trade-off between WebView-based apps and hand-drawn UI: you get Web aesthetics without paying for a browser kernel, but you own every missing widget and edge case yourself.
GoGUI replaces the browser layer with its own component tree, layout engine, font atlas, and SDF shader. It draws everything with OpenGL 3.3 through purego dynamic loading of Win32/WGL, so there is no cgo, no WebView2, and no VC++ runtime. A minimal app is one .exe around 1.5 MB with UPX, down from 6.45 MB with debug info.
The framework reimplements enough of a browser to be useful: Flutter-style constraints layout, SDF-based rounded rects with stroke and shadow in one draw call, a multiline text pipeline with gamma-corrected glyph coverage for Chinese, atlas growth from 256² to 2048² with dirty-rect uploads, and a full IME input path. It also ships a Markdown renderer, charts, tables, video via spawning ffmpeg as a subprocess, and a WebView fallback.
The editor's own benchmarks show idle scenes produce zero draw frames, memory for 13 font instances is 3.2 MB (vs 208 MB with fixed 2048² atlases), and scroll dragging no longer restarts ffmpeg on every mouse move. The framework is Windows-only for now; macOS, Linux, Android, and WASM backends are planned but not shipped.
Spawning ffmpeg as a subprocess avoids cgo and keeps the binary small, but it adds process spawn and pipe overhead; using audio as master clock is a pragmatic fix for A/V drift.
Reimplementing browser features (Markdown parser, syntax highlighter, flex layout, IME) is a large surface; the author admits it's heavy but keeps control. The trade-off is real: teams with front-end familiarity might prefer WebView for speed of iteration.
The gamma correction finding (0.55 for bright text) shows that naive sRGB blending isn't enough for CJK small fonts; browsers apply coverage gamma, and self-drawn UIs must replicate it to avoid blur.
Supersampling doesn't automatically fix text: the author found that gamma compensation should NOT be scaled down with SSAA because the box filter linearly averages sub-samples, so a uniform gamma works across all scales. This is a non-obvious detail for anyone doing SSAA.
Batch rendering with SDF for all shape effects (fill, stroke, shadow) is a clever way to cut draw calls, but it couples effects into a single shader; adding a new effect requires shader changes, not just a new draw path.