r/GraphicsProgramming • u/aartedocodigo • Dec 27 '23
Question Dear Imgui GUI alternative in retained mode
Dear Imgui is great
Lightweight (full demo ~ 1 MB - low RAM consumption)
No bloat No dependencies - static link
Run on big 6 (Win/Linux/Mac/Android/iOS/Wasm) and more
Simple code
It's fast (using hardware accelerated video)
Almost perfect for games and alike
Good for GUIs
Some optimizations for immediate mode wasting
MIT licensing
The problem is rendering the entire screen every frame or when some pixel needs to be updated (I know it has some optimizations), it's power inefficient (just not mobile friendly). I ran some informal simple tests using some optimizations. It uses a little less CPU but a lot more GPU.
Is there any alternative using retained mode with the (near) above characteristics when we are only looking for GUIs?
Qt is out. All techs failing at many bullet points above are out. I'm trying https://slint.dev/ now.
10
u/scallywag_software Dec 27 '23
Immediate-mode vs. retained mode have nothing to do with whether the entire screen gets redrawn every frame. An IMGUI implementation could certainly update only regions of the screen based on what changed frame-to-frame. You're probably correct that DearImgui does redraw the screen every frame. That said, you're also probably over-estimating the amount of work that requires by a metric fuck-ton.
Before you make claims like this, make or source benchmarks that prove what you're saying is true. If you're claiming something like QT (a retained mode UI framework) is going to be more efficient overall than DearImgui I'm highly, highly sus of that claim. I would guess for a comparable UI it used 10x more memory and a similar amount of CPU
0
u/aartedocodigo Dec 27 '23
I know Dear Imgui has many optimizations to update regions, but still uses lots of GPU (it's fast, but not efficient, I am watching just battery consumed).
I have not a benchmark to prove my claim. Have you any one to prove the opposite and share with us? I just has lots of comments at many platforms saying it's inefficient. No one proved it is or it is not.
I need an alternative or proof that DI is giving me almost same efficiency for traditional GUIs as Qt ou another similar product (Qt is out for me).
5
u/exDM69 Dec 28 '23
This does not deserve a downvote.
Just rendering a black screen at 60 fps is power inefficient, my laptop fans start spinning after about a minute of that.
With immediate mode GUI you have the inherent page tearing problem, and it is difficult to make it draw only when needed. At the very least you need to draw 2 consecutive frames when you get an input event.
Last I used Dear Imgui (disclaimer : years ago) it had no functionality to tell if a repaint is needed or not. Very difficult to make an efficient GUI for an application that does not continuously render new frames.
2
3
u/aleques-itj Dec 28 '23
Are you just sitting there spinning the UI at 1300 fps?
There's numerous things you can do. You can cap the framerate and sleep in the spare time. Just using vsync will probably get you a good way there - your hardware will be snoring.
If that really doesn't get you far enough, you can just set up some basic logic to only update the UI when there's input. If you don't care about animations, this is probably like 10 lines of code.
1
u/aartedocodigo Dec 28 '23
Maybe it help me. I will investigate about cap fps when power is a problem. The problem is cursor blinking and cursor moving is an input. It's possible to get some gain.
Thank you for really trying to help.
2
u/scallywag_software Dec 27 '23
I just has lots of comments at many platforms saying it's inefficient. No one proved it is or it is not.
If lots of people are saying it's inefficient, but nobody is providing proof, I'd say that's indicative there are a lot of people on the internet prepared to say random unsubstantiated shit.. including me. I do not have a benchmark to substantiate my claim because I don't care either way, but having written an IMGUI myself, and used several retained-mode GUIs. I'd put a vegas bet on my claim.
I need an alternative or proof that DI is giving me almost same efficiency for traditional GUIs as Qt ou another similar product (Qt is out for me).
I do not know what DI is here. If you didn't look for or produce benchmarks, how can you be assessing the options?
It would also help to add information to your original question about what hardware you're targeting, what acceptable performance targets are, and what the complexity of the UI you're planning on making is going to be. Are we talking about 100 widgets, or 100 windows and 1000s of interactable things?
-5
u/aartedocodigo Dec 27 '23
I'm talking about Dear Imgui.
For desktop I'm ok, but for mobile I need to care about battery.
Think about LOB application with lots of Forms, Reports, Graphs (including real time updates), Text Editors with medium complexity.
You give me some good insights.
Can you bring more strength about your bet on your claim?
3
u/scallywag_software Dec 28 '23
What? No, I'm not doing your work for you.
-1
u/aartedocodigo Dec 28 '23
Ok, my work now is guessing about your thoughts.
2
u/IceSentry Dec 28 '23
No, your work is to actually do the benchmarks. If the answer was easy you'd already have found one.
0
5
u/track33r Dec 27 '23
Inefficient compared to what? Have you done any benchmarks? Retained mode frameworks do the same under the hood but with more bloat.
-8
u/dontyougetsoupedyet Dec 27 '23 edited Dec 27 '23
Retained mode frameworks do the same under the hood but with more bloat.
You can't be serious... This is the dumbest commentary I've read on this sub so far.
This has been one of the worst programming related subreddits to read by a stretch.
-1
-11
u/aartedocodigo Dec 27 '23
Are you saying it's efficient? Have you done benchmarks? Can you share with us?
-8
u/aartedocodigo Dec 27 '23 edited Dec 27 '23
Ok. You asked to show benchmark, you are right. I asked for the same, I'm wrong. Good logic here.
Some dislikes is good to show how stupid some people are. Send me more, prove I'm right.
8
u/RawAustin Dec 28 '23
That's not how making claims works at all. If you state something, the onus is on you to provide evidence. They never stated that it was more or less efficient, they just wanted numbers to back up your claims especially in the absence of any meaningful metrics.
Otherwise most fields of science would simply have people claiming whatever they please and acting as though it were true, then expecting everyone else to do the legwork to prove them wrong.
8
u/[deleted] Dec 27 '23
See if Nuklear GUI better suits you. They use command buffers. Dont know if that helps.