Hacker News new | ask | show | jobs
by pciexpgpu 2606 days ago
The author does a good job explaining some benefits of an immediate mode renderer but vastly misses the disadvantages.

The immediate mode renderer is great for toy programs. Similar to how you could reproduce 'look here is how simple it is to write hello world and compute the millionth digit of PI' in a new esoteric language...

Occlusion, hit-testing, state changes, scrolling/animations even in the simplest forms will fall over. Infact, that's why we have every major browser move their touch and animation systems into a layer based compositor system (into a separate thread / process).

The author also grossly misses their own example of 'how a spreadsheet with many rows and columns will update faster using ImgUI' and how Instagram styled apps will fare better ImgUi.

A retained mode renderer will use virtual scrollers, efficient culling of nodes for both display and hit-testing (scale to billions of virtual cells) and more importantly help a team of people coordinate their work and get things done.

We are no longer in the 90s.

3 comments

The problem with ImGUI is that your gui tree is function call tree and you can't do much with that unless you are in lisp.

Function call tree has some advantages. Functions are wonderfully composable and flexible.

React is such a revolution because it translates ImGUI usage into whatever insane retained mode API is at the bottom of the stack, through intermediate representation of virtual dom.

Presto. You have flexibility and composability of ImGUI without disadvantages of keeping your gui tree only in your function calls, and you can use it without ability to directly control how the GUI is drawn in the engine.

> A retained mode renderer will use virtual scrollers, efficient culling of nodes for both display and hit-testing (scale to billions of virtual cells)

A good IMGUI will do this too (e.g. Dear IMGUI already does)

In fact, with Javascript JIT engines (whose teams deeply understand the use of libraries like React) relentlessly attacking the overhead of DOM nodes and their initialization, and with users who actually expect the design flexibility provided by CSS... a system like React is actually an ideal layer of abstraction for modern UI implementation on practically any platform.

Sure, if you're on an embedded platform, somewhere a JIT can't run, or if you're doing something with real-time rendering requirements (and honestly modern React Suspense should even make that feasible), you may want to use something lower-level. But most people won't need to do this.

The DOM being slow is really more an artifact of browsers/HTML and the history behind doing document based layout. React is a nice solution to that specific problem; but this article suggests immediate mode gui's are the future, which, I don't think that's really the case. And I'm not sure I'd really call React an IMGUI anyway. It's similar, but it's also pretty different.