I recently came across this article on the HackerNews front page. It was written by the author of the Gio UI, an immediate mode GUI library in Go.

Granted I am not very familiar with the GUI story in Go, but this is the first time that I heard of this library and it seems interesting. In it the author explains what is immediate mode GUI and illustrates how to use Gio to implement some common paradigms. And the author highlights its simplicity and motivates the usage of immediate mode. It was written by the author of the Gio UI, an immediate mode GUI library in Go.

Immediate Mode and Retained Mode GUI

Immediate mode model in GUI, as opposed to retained mode, handles the drawing directly in the application in a procedural way, and does not store a scene model between frames1.

Notable libraries in various languages include Dear ImGui (cpp), egui (rust), and Gio (go).

Casey Muratori of handmade hero fame is one of the original pioneers of immediate mode user-interfaces. There is a presentation available. And it is also cited in the blog post.

The discussion on HackerNews also pointed out some limitations of immediate mode. @SeanAnderson pointed out that:

It’s really easy to get started with immediate mode and bust out some simple UIs, but the second you start trying to involve dynamically sized elements and responsive layouts — abandon all hope. The fact it has to calculate everything in a single pass makes these things hard/impossible. Coming from a strong CSS/React background I find the limitation maddening.

And he gives an example of limitation in egui, where it does not support putting two widgets in the center of the screen: https://github.com/emilk/egui/issues/3211.

Another comment points out that one of the reasons immediate mode GUI is popular in game development is that it is a useful tool to “quickly hacked debug tools to interleave UI and regular logic and not do a logic/view separation”.

Footnotes

  1. https://learn.microsoft.com/en-us/windows/win32/learnwin32/retained-mode-versus-immediate-mode ↩