|
> I think immediate-mode UI is awful (does lot of useless work, redraws whole window on every mouse move). Also I think GPU support is not that important: If you're concerned about efficiency, GPU support is very important. But IMGUI is not the efficiency enemy you think it is; while IMGUI libraries do need to traverse the hierarchy of visible objects on every mouse movement, there are generally only a few dozen rectangles and a few thousand letters and other graphical objects visible, so the work involved in traversing them is generally very small amount compared to copying a few million pixels into the framebuffer. As an example, I currently have a browser viewing HN and an Emacs window open, and they total about 3000 characters (1523 mostly-blank characters and 206 words in Emacs, 335 words in HN, plus chrome), a couple dozen icons, and another dozen or so roundrects. But my screen is 2 million pixels. So the amount of per-drawable work has to be almost three orders of magnitude larger before the per-pixel work isn't the dominant factor. IMGUI libraries do have to do a bit more work to avoid redrawing all those pixels on every mouse movement, but many popular IMGUI libraries, such as React, do in fact do that work. It's a somewhat less simple job than for retained-mode GUI libraries like Qt (or the browser DOM), but the added complexity in the IMGUI library often pays off in simpler and more reliable apps. |
Only in a hello world application. Every professional editor like GIMP has tons of tiny widgets. And redrawing one tiny widget on mouse over is faster than running the render function.
Also, you are assuming that running render function costs nothing while in real-world apps there will be layout calculations (because you don't want to position widgets manually), array iteration (for example, to display a sum and average of values from a 100K element array), text characters layout, calling helper functions, generating SVG for a 10K points graph, some genius might add reading from a file, etc.
Yes, writing good code is harder than bad code, especially for a LLM.
And if you are on the stage where you need widgets and layout calculation, why not add a dirty flag and damage rectangles as well, I cannot understand.