I got fed up of ImGUI when I wanted to route events to my application instead of the GUI. Its good "out the box" ut when you need to get down and dirty to customise, it can be awkward. Nowadays I do a hybrid approach, so I have use NanoGUI and create my own "live data" "retained mode" controls. Now I have either the best of both worlds or the worst of both worlds. I think the best: Pros: - I don't have to bother with…
Could ImGUI Be the Future of GUIs?
101–110 of 128 posts
Re: Could ImGUI Be the Future of GUIs?
#102I got fed up of ImGUI when I wanted to route events to my application instead of the GUI. Its good "out the box" ut when you need to get down and dirty to customise, it can be awkward. Nowadays I do a hybrid approach, so I have use NanoGUI and create my own "live data" "retained mode" controls. Now I have either the best of both worlds or the worst of both worlds. I think the best: Pros: - I don't have to bother with…
This is the exact issue I'm running into right now with dear ImGui. There is no event propagation. You can either transfer control over to ImGui, or you retain control. In Qt it would be possible for the focus widget to not accept events, so they would bubble up the hierarchy. Considering how the hierarchy is tied to the callstack, this seems difficult to achieve with an ImGui.
Re: Could ImGUI Be the Future of GUIs?
#103Earlier quoted context omitted.
I don't understand the problem. 2000Hz = 0.5ms/frame; 20% of this = 0.1ms. That sounds like a great result. Your target frame rate is presumably 60-100Hz, assuming it's a PC game, meaning your frame budget is 10-16ms. If your UI takes 0.1ms, you've got >99% of your budget left. (Also: 3-4K vertices for UI was about what you could expect to budget for a PS2 or Xbox game! - max throughput for PS2 was something like 250…
I should mention that 2000 Hz when only running the UI -- with the full game running at 150 FPS. So really the CPU time is 6.66ms*0.2 = 1.33 ms just for the UI! Of course, that's on my beefy machine with a octo-core overclocked CPU and a couple 1080Tis. But what about the players who are trying to play on their mobile CPUs with integrated graphics? That margin could be the difference between 45 and 60 FPS.
Re: Could ImGUI Be the Future of GUIs?
#104Earlier quoted context omitted.
Adding a separate complex ad hoc memory allocation scheme is not what I would call free. Granted, computationally-wise it may be relatively cheap but it does add multiple forms of complexity to a problem that doesn't exist in rmguis.
Arenas are the simplest allocation scheme ever. // Start of frame void *arena = malloc(LOTS_OF_MEMORY); void *next_ptr = arena; // Allocate something object = *next_ptr; // return that value next_ptr = object_size + alignment; // crash if out of memory // End of frame free(arena); By the way, such "separate complex ad hoc" memory allocation schemes are the reason why manual memory management is faster than garbage co…
Re: Could ImGUI Be the Future of GUIs?
#105I'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?
Games (normally) re-render the whole scene every frame. ImGUI exposes that to their API users: you have to re-render and check for clicks on every frame. The code looks like React, (but not as optimized, it re-renders every frame!), and normally you have to keep state by yourself. Code example: [1]. Retained Mode is closer to the DOM, Cocoa or WPF: you create objects and there's an abstraction between the API and the…
They don't re-upload the whole scene to the GPU every frame, they don't recreate objects all the time. Immediate mode was only used in, like, the GL 1.x times.
Re: Could ImGUI Be the Future of GUIs?
#106Didn't Firefox put forward a big plan to basically implement the browser as an immediate mode UI designed to redraw everything on every frame?
Immediate doesn't mean just redrawing everything on every frame, immediate means what's described in the article — not keeping state. WR aggressively relies on kept state to optimize rendering of each frame as much as possible.
Re: Could ImGUI Be the Future of GUIs?
#107Earlier quoted context omitted.
Arenas are the simplest allocation scheme ever. // Start of frame void *arena = malloc(LOTS_OF_MEMORY); void *next_ptr = arena; // Allocate something object = *next_ptr; // return that value next_ptr = object_size + alignment; // crash if out of memory // End of frame free(arena); By the way, such "separate complex ad hoc" memory allocation schemes are the reason why manual memory management is faster than garbage co…
No need to malloc each frame. Malloc at startup and memset each frame (don't even need to do that, tbh).
Re: Could ImGUI Be the Future of GUIs?
#108Earlier quoted context omitted.
>Why settle for "good-enough" performance? Because its good enough? Perfection is the enemy good. I can't see 2000 FPS, 60 FPS is good enough for me. Similarly the 20% vertex buffer hit might not matter.
The catch is that games follow the law of "MOAR!": more details, more effects, more postprocessing, mpre abimation, more simulation... this means that the engine will almost always be pushed to max out the hardware long before the designers are happy with what they have. Heck, I can think of pretty easy ways to improve sound and video quality of games in ways that are quite fundamental, but that would easily max out…
Re: Could ImGUI Be the Future of GUIs?
#109Sometimes 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.
Beyond the absolute simplest of toy UIs, immediate mode doesn't work in my opinion.
Re: Could ImGUI Be the Future of GUIs?
#110As 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'm working on right now is not incredibly complicated, it'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 "window" 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 "safe area" (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.
So, no, immediate GUI is definitely not the solution here.