TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Could ImGUI Be the Future of GUIs?

224 pointsby tokyodudeabout 6 years ago

42 comments

overgardabout 6 years ago
Really probably not. I love them and they&#x27;re very handy in certain situations (debugging tools, quick UIs) but once you need a lot of customization they become extremely cumbersome. Also really kind of makes it impossible for designers or less technical people to do anything. Also, while I think separating view logic is slightly overrated, it is useful, and it&#x27;s very hard to do that with IMGUI. Also it doesn&#x27;t thread well. Also... Look there&#x27;s like a million downsides.<p>Also saying there&#x27;s no memory allocation is really misleading. There&#x27;s PLENTY of memory allocation, per frame, you&#x27;re just not explicitly doing it yourself. It&#x27;s actually much worse than an RMGUI in this regard, because at least with an RMGUI you get the allocations over with once. With an IMGUI you&#x27;re allocating things all the time. They&#x27;re probably much smaller allocations, but lots of small allocations does not make for good performance.<p>One final note, the Unity 3D example always gets used. If you&#x27;ve ever written a plugin for unity or a custom editor, you&#x27;re very familiar with the fact that it&#x27;s editor gui system is extremely limiting and kind of sucks. I mean, it&#x27;s an example, but once you&#x27;re past the basics it&#x27;s kind of a bad example.
评论 #19768531 未加载
评论 #19769433 未加载
评论 #19768690 未加载
yonilevyabout 6 years ago
FWIW, Unity are moving away from ImGUI (to a classic retained mode UI system) <a href="https:&#x2F;&#x2F;blogs.unity3d.com&#x2F;2019&#x2F;04&#x2F;23&#x2F;whats-new-with-uielements-in-2019-1&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blogs.unity3d.com&#x2F;2019&#x2F;04&#x2F;23&#x2F;whats-new-with-uielemen...</a>
评论 #19769243 未加载
theclawabout 6 years ago
In the context of creating debugging UIs for games and graphics applications, Dear imGUI is a godsend. Programmers love it because there is literally only the code to worry about. It&#x27;s very easy to get it up and running, and all the code that handles the UI drawing and interaction is in one place so it&#x27;s easy to reason about.<p>It works very well in the context where you already have fast graphics and an update loop, and you&#x27;re already expecting to redraw the whole screen every frame. It does not really suit more complex, text-heavy UIs where you&#x27;re rendering thousands of glyphs with proper kerning and ligatures and anti-aliasing, etc, and want the result of that hard work to be retained in the framebuffer unless it absolutely needs to change.
评论 #19768268 未加载
评论 #19768814 未加载
pciexpgpuabout 6 years ago
The author does a good job explaining some benefits of an immediate mode renderer but vastly misses the disadvantages.<p>The immediate mode renderer is great for toy programs. Similar to how you could reproduce &#x27;look here is how simple it is to write hello world and compute the millionth digit of PI&#x27; in a new esoteric language...<p>Occlusion, hit-testing, state changes, scrolling&#x2F;animations even in the simplest forms will fall over. Infact, that&#x27;s why we have every major browser move their touch and animation systems into a layer based compositor system (into a separate thread &#x2F; process).<p>The author also grossly misses their own example of &#x27;how a spreadsheet with many rows and columns will update faster using ImgUI&#x27; and how Instagram styled apps will fare better ImgUi.<p>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.<p>We are no longer in the 90s.
评论 #19769852 未加载
评论 #19769376 未加载
评论 #19768666 未加载
mooman219about 6 years ago
This is really reads like someone trying to sell you something. I&#x27;ve done work on frameworks for both immediate mode and retained mode GUIs. They both absolutely allocate memory behind the scene. There absolutely is state being marshaled around. Caching commonly used state is important. Performance can be bad and great in both. You&#x27;re really just subscribing to different sets of opinions
评论 #19768200 未加载
seanalltogetherabout 6 years ago
I think the author is over exaggerating the problem of object creation and destruction in traditional gui frameworks. List&#x2F;collection views are designed to reuse objects as you scroll. Secondly I think the author is also downplaying the fact that retained GUIs can also cache object rendering. Just as the gpu doesn&#x27;t have to draw the whole screen when only the cursor is blinking, it also doesn&#x27;t have to redraw widgets unless their size changes.<p>Immediate vs retained is a simple case of budgeting against cpu usage or memory usage, and it should be considered in that light. (immediate uses more processing, retained uses more memory)
评论 #19768189 未加载
geekpowaabout 6 years ago
Retained GUIs vary wildly in implementation.<p>Many of authors most significant criticisms on retained GUIs are implementation considerations. GUI frameworks exist that solve his key criticisms of complexity and are pleasant to work with.<p>Criticisms that target core architecture of retained GUI I don&#x27;t consider to be valuable design goals, at least in settings where I work on GUIs. e.g. memory usage.<p>Alot of things are glossed over that remain challenges in both, e.g. layout management.<p>HTML is an interesting example. First iteration of HTML was essentially immediate mode if you think about a single client&#x2F;server interaction as a GUI update cycle. Server sends draws to client browser and client browser sends back to server user selections. There is no retained state on gui side. Now with programmatic access to DOM, ability to attach events to DOM elements from client side it is now a retained GUI. Seems to be where things evolve to naturally.<p>The GUI framework I use nearly daily is retained and very pleasant to work with in terms of ease of belting out screens &amp; readability&#x2F;maintainability of code. The simplicity comes with compromises though as there are limits on GUI idioms that can be expressed. Occasionally run into those boundaries and resulting GUI does look a little plain and unexciting, but for something that is substantially about data entry its fine.
arianvanpabout 6 years ago
Recently I started playing with <a href="https:&#x2F;&#x2F;github.com&#x2F;ajnsit&#x2F;concur-documentation&#x2F;blob&#x2F;master&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ajnsit&#x2F;concur-documentation&#x2F;blob&#x2F;master&#x2F;R...</a> which has been the most refreshing UI paradigm i&#x27;ve used in a while. and it reminds me a lot of this ImGUI approach, but behind the scenes it uses coroutines instead.<p>The idea is that a button is a UI element that _blocks_ until an event is fired. You can then compose elements in time like:<p><pre><code> button &quot;hey&quot; &gt;&gt; label &quot;clicked&quot; </code></pre> which is a program that displays a button, you click it, the button goes away and the text &quot;clicked appears&quot;<p>Or you can compose programs in space:<p><pre><code> (button &quot;hey&quot; &lt;&gt; label &quot;not clicked&quot;) </code></pre> this is a program that displays both a button, and a label at the same time.<p>Now, by combining both space and time, we can create a program that changes the label when clicking as follows:<p><pre><code> program = (button &quot;toggle&quot; &lt;&gt; label &quot;off&quot;) &gt;&gt; (button &quot;toggle&quot; &lt;&gt; label &quot;on&quot;) &gt;&gt; program </code></pre> This is an application that toggles a label on and off when you press a button. (Note that the definition is recursive)
RandyRandersonabout 6 years ago
There&#x27;s a difference bt poor impl and poor design.<p>As the author points out, HTML has a poor design (eg. if you want to have a 1000x1000 cell table, you have to have 10^6 actual cells - that&#x27;s a lot of tds or whatever to parse).<p>Modern OO GUI frameworks don&#x27;t do this - they say something like:<p>cellRenderer.draw(target, row,col,position,size)<p>No creation of objects required. Of course since it&#x27;s so easy to create OO programs a lot of code isn&#x27;t great... and then others copy that code and so it goes.<p>Seems like we keep re-creating software b&#x2F;c we haven&#x27;t taken the time to look at what exists and only then decide on what to keep and what to change. &quot;This is too complex - I&#x27;ll re-write it!&quot;. 10 years later: &quot;We added all the features that the existing software had and now the new one... is just as slow... but we did sell a lot of conference tickets and books so... totally worth it.&quot;<p>When I was 20 I also thought I knew better so I get it.
babel_about 6 years ago
I feel that the future lies in combining retained and immediate interfaces, preferably with the granularity to allow deeply nested retained interfaces that are fast for complex ui (or for a realtime system with memory to spare), whilst still allowing one to go the other direction, such that a simple ui can be written cleanly and logically for low-memory systems (such as embedded or boot guis). It would need a very well designed api for this, but I feel the benefits are worth the effort (and I&#x27;ll probably look into this next time I have the freedom to choose ui apis).<p>A balance may be letting people define it either way, so that manually written ui still can have auto-layout yet intuitive code (following control flow primitives), whilst allowing generated retained uis to be manually editable -- perhaps even allowing one to then embed one within the other, a boon for scripted interfaces that perhaps have people of various levels of experience producing ui elements, such as a musician with little experience being able to add a simple visualiser in an immediate manner to a deeply retained daw gui.<p>Of course, there&#x27;s a lot here that is implementation, and some criticism either way can be optimised out. Immediate mode can still cache its rendering, we&#x27;ve had optimised blitting since the early days, and is only usually a problem with complex ui. Retained would get fewer cache misses if we weren&#x27;t allocating madly across the heap and took a more disciplined approach allocating to contiguous memory -- which is almost entirely a language&#x2F;api problem (in my experience) that can also happen with immediate but we typically don&#x27;t see since it&#x27;s often done in a more procedural style that is allocating to some pool.<p>Other api elements, such as handling lists etc aren&#x27;t really a differentiation between retained and immediate, those can be made in either.<p>For me, I often find that the ability to write out prototype ui code in an immediate style in very quick and satisfying (exactly what I want in prototyping), however once I start to expand upon a ui, I find it best to over time refactor towards a retained style, since by then I will typically have some templates for what ui elements look like, and so I just have to pass a string and function pointer to fill in the template.<p>Can&#x27;t see why we can&#x27;t have nice things and let both coexist...
pedrocrabout 6 years ago
Conrod is an immediate mode GUI library for rust[1]. I&#x27;ve been using it for an image processing app[2] and have enjoyed the way the code turns out. Everything is much more straightforward as you don&#x27;t have to reason about callbacks interacting with a loop that&#x27;s not yours to control and the performance seems good.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;pistondevelopers&#x2F;conrod" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pistondevelopers&#x2F;conrod</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;pedrocr&#x2F;chimper" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pedrocr&#x2F;chimper</a>
thraxabout 6 years ago
Immediate mode uis are fine for debug displays or for displaying data that&#x27;s changes every single frame, but for anything else, in a shipping product they are just a waste of resources. The primary wasters are excess memory allocation, string generation, and the sheer amount of redundant function calls. Anything you do to address those problems result in converting your ui to a retained mode UI. For those advocating react like approaches to solving this.. similar problems are involved. Diffing state is wasting cycles unless it&#x27;s done so optimally and carefully that it becomes a technical feat and ends up being as complex as just doing something retained. Source: game developer for 25 years on console, desktop, and mobile.
seanmcdirmidabout 6 years ago
Probably not. With technologies like React that make retained-mode UIs look more like immediate-mode ones, there is less need for full blown immediate-mode UIs. React achieves the programmability of an immediate-mode UI without sacrificing the performance of a retained-mode UI (at least, that’s the goal).
weinzierlabout 6 years ago
&gt; A few problems with this GUI style are:<p>&gt; You have to write lots of code to manage the the creation and destruction of GUI objects. [..]<p>&gt; The creation and destruction problem leads to slow unresponsive UIs [..]<p>&gt; You have to marshal your data into and out of the widgets. [..]<p>My biggest pain point with the retained mode GUIs I worked with was none of the issues mentioned above. It was always the centralized GUI thread and the consequential synchronization complications. I don&#x27;t know if this is an inherent problem of retained mode GUI frameworks and if there are some that don&#x27;t force all widgets into a single thread. If not, this alone is a reason to for me to find immediate mode interesting.
评论 #19768427 未加载
Klonoarabout 6 years ago
I recall reading this article in your comments on the last GUI-specific link posted here... where you just kept disagreeing with comments that took the time to point out how this stuff is largely off base.<p>We moved away from WM_PAINT for a reason.
amlutoabout 6 years ago
Here’s a downside that wasn’t mentioned:<p><pre><code> if (ImGUI::Button(&quot;Click Me&quot;)) { IWasClickedSoDoSomething(); } </code></pre> This forces Button to be stateless, which limits the possible quality of implementation. If you mouse-down on a button and the button changes before you mouse-up, it shouldn’t register as a click. Similarly, if you mouse-down on a button, drag to the button, and mouse-up, it shouldn’t be a click. Implementing this in a fully immediate-mode GUI with this interface is either impossible or requires gross hacks.
评论 #19769116 未加载
评论 #19770301 未加载
jbverschoorabout 6 years ago
Can we please just stop moving around in circles in the tech industry? Nobody seems to learn anything from past methods, tech and everything.
评论 #19769432 未加载
评论 #19769932 未加载
jayd16about 6 years ago
IMGUI must sound appealing to people who have never done UI work. Just try to implement a responsive UI in an IMGUI. Layout code is not fun.
laytheaabout 6 years ago
I got fed up of ImGUI when I wanted to route events to my application instead of the GUI. Its good &quot;out the box&quot; ut when you need to get down and dirty to customise, it can be awkward.<p>Nowadays I do a hybrid approach, so I have use NanoGUI and create my own &quot;live data&quot; &quot;retained mode&quot; controls. Now I have either the best of both worlds or the worst of both worlds. I think the best:<p>Pros: - I don&#x27;t have to bother with data binding. As the control is passed a pointer to the actual memory for he value, it can &quot;go get it&quot; when rendering, rather than my application setting its state. - I still have classes to represent elements and state, so its conceptually simple to build controls on controls. I found this difficult with Imgui.<p>Cons: - renders 100% full speed, but I am working on way to speed up and slow down render loop depending on user activity, so that when sitting idle, the cpu is not burning.
评论 #19770357 未加载
评论 #19770920 未加载
sagoabout 6 years ago
I have implemented a bunch of UIs for games. Immediate mode sounds good, but each time the thing that has bit me has been layout.<p>Sometimes you need to traverse the hierarchy to figure out where things will be placed. Before traversing it for render. If your hierarchy is implicit in a call graph, you have to either duplicate your calls, or implement some kind of backend retained system so you can defer rendering until after layout.<p>Beyond the absolute simplest of toy UIs, immediate mode doesn&#x27;t work in my opinion.
golergkaabout 6 years ago
Every time a developer decries some abstractions and tools as unnecessary complicated and too &quot;enterprise&quot;, it probably means he haven&#x27;t encountered a problem that this solution was created to address.<p>As a Unity developer, I love immediate mode GUI for debugging. But I would never in my right mind attempt to use it for actual in-game GUI. Project I&#x27;m working on right now is not incredibly complicated, it&#x27;s just a typical mobile match3 game. But a typical screen here has: (1) background that has to be scaled over all screen, eveloping it around while keeping aspect ratio, (2) frame that has to be scaled to screen without keeping aspect ratio, (3) a &quot;window&quot; background that has to be scaled somewhat to screen (with margin), being enveloped by it, (4) interactive elements, that have to be scaled down from the &quot;safe area&quot; (so that there are no button under the iPhone bevel), (5) match3 game field that has to be scaled according to physical sizes of the screen, (6) pixel-perfect elements that have to be chosen according to pixel size of the screen (1x, 2x and 3x options) and scaled appropriately.<p>So, no, immediate GUI is definitely not the solution here.
ahaferburgabout 6 years ago
From dear ImGui&#x27;s mission statement:<p><i>&gt; Designed for developers and content-creators, not the typical end-user! Some of the weaknesses includes:<p>&gt; - Doesn&#x27;t look fancy, doesn&#x27;t animate.<p>&gt; - Limited layout features, intricate layouts are typically crafted in code.</i><p>It may not replace retained mode GUI toolkits, but it can certainly make the life of devs easier. If all you need is to quickly hack together an internal tool, or some quick debugging interface, keep ImGui in mind.
zzo38computerabout 6 years ago
I have seem other programs doing stuff like that before, and I have also done some of that in my own programming (although not with this or any other library). I did not know what it is called, until I read this today. It look like good to me. Also, you will still need to add some extra variables if you are doing such thing as tab to focus, I think.
4thaccountabout 6 years ago
Anyone experienced with ImGUI ever use Rebol and Red&#x27;s DRAW DSL?<p>I believe Rebol&#x27;s GUI support is even easier to use than ImGUI, but of course it can&#x27;t be embedded and used in the same way as ImGUI either. I wonder if non Red projects could possibly hook into Red&#x27;s system once Red&#x2F;System gets closer to C level performance?
nh2about 6 years ago
&gt; ... people scroll almost constantly in which case the ImGUI wins by a landslide<p>I think this is a misrepresentation of how fast scrolling is usually implemented.<p>For fast scrolling, you render the page (which is larger than the viewport = &quot;what fits on the monitor&quot;) ONCE onto a GPU texture, and then all scolling happens on the GPU side (the CPU just tells the GPU the offsets into that texture).<p>Immediate mode has to recreate the texture every frame, instead of once for multiple frames. So &quot;It might use more CPU&quot; is quite certainly true.
评论 #19768807 未加载
评论 #19770265 未加载
评论 #19768947 未加载
627467about 6 years ago
I&#x27;m having a hard time to understand what is ImGUI (and what is the opposite RmGUI)... any could help me with ELI5? It sounds like ImGUI is reactive while RmGUI is not?
评论 #19769209 未加载
评论 #19769246 未加载
评论 #19770354 未加载
评论 #19769140 未加载
dangabout 6 years ago
Related recent thread: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=19744513" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=19744513</a>
dwrodriabout 6 years ago
Great find! I haven&#x27;t done much work GUIs myself, but I would love to read more about alternative design philosophies in human-centered computing and their downfalls.
cotellettaabout 6 years ago
React hooks is the closest you&#x27;ll get in practice, once you factor in async, layout measurements and other practical things. But useState is pretty much just imgui with built in getters&#x2F;setters rather than external state.
polytronicabout 6 years ago
The single most important factor when it comes to UI is text rendering. Immediate mode UIs are based on text rasterization, ie polygon creation for each character of the text while retained mode text is usually featuring texture atlases containing all characters in upper and lower case. This of course introduces a limitation on the number of fonts available to the developer, font sizes, etc. My 3D engine is using an immediate mode UI for the editor and tools while it allows for creation of retained mode UI for in-game UI components by automatically generating texture atlases for the selected font types
etaioinshrdluabout 6 years ago
Didn&#x27;t Firefox put forward a big plan to basically implement the browser as an immediate mode UI designed to redraw everything on every frame?
评论 #19770515 未加载
Vanitabout 6 years ago
I hadn&#x27;t heard of ImGUI, but after reading the definition realised that&#x27;s exactly how you made custom menus in RM2k&#x2F;3 :)
abledonabout 6 years ago
Say I want to make a program, X, that draws a 50x50px square over another program, Y, at (200,100) and only program Y. Do i need a low level stuff for this, can imGUI be used here? or is it possible with electronjs etc... Also, would program Y be able to detect, with administrator privileges that another program was targeting its pixel space and drawing over it?
grifballabout 6 years ago
&gt;programmers find it more performant &gt;plusses speed &gt;minuses uses more CPU what?
qwerty456127about 6 years ago
Are any implementations of this approach available for high-level languages?
pjmlpabout 6 years ago
ImGUI is the past of GUIs.<p>That is how we used to do it on 8 bit and 16 bit platforms, before frameworks like Turbo Vision, GEM and Workbench came into the scene.
rambojazzabout 6 years ago
Could somebody please ELI5 this? How is this different from traditional UI approaches and why would I want to use this?
dzongaabout 6 years ago
this feels more like drawing UI&#x27;s using state charts in terms of expressiveness.
ianrathboneabout 6 years ago
Isn&#x27;t the future of GUIs to have no GUI?
781about 6 years ago
It&#x27;s important to point out why games use immediate mode GUIs:<p>1. The GUI needs to be overlaid on the game image (OpenGL&#x2F;DirectX). This is difficult with traditional GUIs like QT.<p>2. The GUI needs to be updated in sync with the game, again, it&#x27;s difficult to integrate traditional GUIs event loops into the game loop, especially with stuff like double&#x2F;triple buffering.<p>3. The GUI needs to be as fast as possible, games are severely CPU bound.<p>A retained mode GUI is typically easier to use, convenience is not why people use immediate mode GUIs.<p>It&#x27;s worth pointing out that the immediate&#x2F;retained split doesn&#x27;t apply only to the GUI - there are retained mode graphical APIs - DirectX used to have one. They are only used in low-demand games, they sacrifice a lot of speed for the convenience of using a retained mode.
评论 #19768279 未加载
评论 #19768202 未加载
评论 #19768193 未加载
评论 #19768390 未加载
评论 #19769617 未加载
layoutIfNeededabout 6 years ago
So basically go back to WM_PAINT
评论 #19769767 未加载
chaboudabout 6 years ago
No. ImGUI could not be the future of GUIs.<p>GUIs are multi-process, multi-system, multi-clock, multi-network entities, or at least they have the potential to be. Immediate Mode GUIs are almost non-scalable by design.<p>Imagine a multi-system asynchronous AR collaboration environment. Now imagine that as an Immediate Mode GUI. If we had enough horsepower to do that, we&#x27;d be doing something far better with it.