Documentation
¶
Overview ¶
Example: Modular Compositor Pattern
Demonstrates how multiple independent "modules" render offscreen into images and a compositor displays them on a single GPU window. This pattern is used in smart mirrors, kiosk UIs, and digital signage where each panel is an independent process or goroutine.
Architecture:
[Clock Module goroutine] -> channel -> [Compositor goroutine]
[Notification Module goroutine] -> channel -> |
[gogpu Window]
In production, goroutines become separate processes communicating via Unix sockets or shared memory. Channels simulate the IPC for this example.
Each module uses offscreen.NewRenderer to render ui widgets into *image.RGBA without a window or GPU. The compositor receives frames via channels and composites them onto the window using gg.DrawImage.
Rendering: event-driven (ContinuousRender=false). Modules send frames only when content changes. The compositor redraws only when a new frame arrives.