How to use Dear ImGui to build a simple Gui-App Framework in C++

  Рет қаралды 45,733

Zen Sepiol

Zen Sepiol

Күн бұрын

This video shows how to setup Dear ImGui for Ubuntu using Meson.
We create a simple App Framework based on Dear ImGui that can be reused.
00:00 Intro
01:25 Overview
03:02 Setup Dear ImGui
04:44 Run OpenGL example
10:02 App Framework
21:37 Speed up using CRTP
Tools that I use:
www.virtualbox.org/
kubuntu.org/
code.visualstudio.com/
llvm.org/
clang.org/
mesonbuild.com/index.html
In code:
github.com/renatoGarcia/icecr...
github.com/ZenSepiol
github.com/ocornut/imgui
github.com/epezent/implot

Пікірлер: 62
@ZenSepiol
@ZenSepiol Жыл бұрын
There is a new version of the framework available. Easily setup with Docker: kzfaq.info/get/bejne/mdZ6jdF1vM2oop8.html
@igorstasenko9183
@igorstasenko9183 4 ай бұрын
the most funny part is justification of replacing a single virtual call with templated trick.. - for performance! you saved maybe 2 CPU cycles. may the future generations remember your historical deed! :)))
@ZenSepiol
@ZenSepiol 4 ай бұрын
It’s unnecessary, but fun. 😄
@sonfilmy
@sonfilmy Жыл бұрын
Very neat presentation... keep it up !
@ZenSepiol
@ZenSepiol Жыл бұрын
Thank you, I will
@mohamedhussien4013
@mohamedhussien4013 26 күн бұрын
Great tutorial. Thank you so much.
@moya_mama
@moya_mama Жыл бұрын
thanks top video 🔥 Explained everything very well.
@ZenSepiol
@ZenSepiol Жыл бұрын
Glad you liked it!
@borysjelenski5919
@borysjelenski5919 2 жыл бұрын
When it comes to using CRTP for eliminating virtual calls you could have just make those member functions non-virtual by ditching the unnecessary inheritance in the first place. I know, it's just an example but my take on this is that we should strive to use abstractions, language constructs, etc. only when there's an actual need for it. Nevertheless, that was a very nice tutorial, thank you.
@ZenSepiol
@ZenSepiol 2 жыл бұрын
Yes you are right for this example. I did it since I am reusing the „App“ class in different other projects as well.
@user-ox7gf3ok9n
@user-ox7gf3ok9n 2 жыл бұрын
Had a Qt setup at my previous job for a game editor. Good Lord how outdated it feels in comparison to alternative solutions. It was like a time machine back in 98.
@ZenSepiol
@ZenSepiol 2 жыл бұрын
So true! Some companies dont even realize how outdated their technology stack really is.
@josh5457
@josh5457 Жыл бұрын
thanks for this
@ajaysailopal1096
@ajaysailopal1096 11 ай бұрын
Thank you thank you thank you
@ajmanuel1978
@ajmanuel1978 Жыл бұрын
amazing
@ZenSepiol
@ZenSepiol Жыл бұрын
Thank you! Cheers!
@JuanGarcia-lo2el
@JuanGarcia-lo2el 9 ай бұрын
Hello there! Amazing video! I have a question: Is it possible add a GUI using Imgui to an exist C++ console program? I mean by "console program" to those C++ programs that receive input from the terminal. Hope I made it clear. 😃
@ZenSepiol
@ZenSepiol 9 ай бұрын
Sure, should be possible. If you can share the code of your program on github, and tell me what you want in the GUI, I might even do it.
@Kira-cs5tt
@Kira-cs5tt 2 жыл бұрын
first time seeing crtp, but im curiours as to what kind of performace gains you were hoping to get ? as it seems like the code is actually running 10-15 % slower when using crtp from about 9/10ms/frame without to 13ms/frame with crtp
@ZenSepiol
@ZenSepiol 2 жыл бұрын
Interesting results! Which optimization level are you using? CRTP works best at high levels and could even make your code slower at no optimization. Anyway I will double check in this case 😀
@picolosangoku7347
@picolosangoku7347 9 ай бұрын
Hello, I had the same remark as Kira. In your vidéo we can see the FPS of the ImGUI App and we see in your vidéo that the crtp optimization slow the code by 10-15%. So Im curious about what is exactly crtp, why it doesn t work in this case and in which case can we use crtp to improve performance. (Thanks for your vidéo between 😉)
@ZenSepiol
@ZenSepiol 9 ай бұрын
Its mostly about optimization level. Low optimization level is bad for CRTP.
@lm_123
@lm_123 Жыл бұрын
nice video
@ikomatteo3177
@ikomatteo3177 Жыл бұрын
shouldn't we leave the virtual on the base class destructor even with crtp? although it wouldn't seem practical, it's still possible to create the app as Base* app = new Derived; delete app; // calls only base destructor instead of chaining destructors
@ZenSepiol
@ZenSepiol Жыл бұрын
Yes, you are right! I hope nobody actually does use it like that but it is definitely possible.
@NoBummer
@NoBummer Жыл бұрын
bro u look like my favorite youtuber Mr. Beast!!! Poggers!!!!!
@DjViOd
@DjViOd Жыл бұрын
Unfortunately the glfw-meson git repository is 5 years out of date currently. I can't get it to compile the example you've shown here...
@ZenSepiol
@ZenSepiol Жыл бұрын
You can also use the wrap db file from GLFW: mesonbuild.com/Wrapdb-projects.html Just replace the GLFW wrap file with the content or use meson wrap install glfw in your command line. Then you should end up with the newest glfw version. Maybe I'll create a docker in the future. Would make it easier to reuse on another system. Would you be interested in that?
@lickguitars1276
@lickguitars1276 7 ай бұрын
i wish you could make a complete tutorial about this specific framework because there is not alot of resources to be found
@ZenSepiol
@ZenSepiol 4 ай бұрын
I‘ll do it as soon as I find the time.
@codehard5824
@codehard5824 Жыл бұрын
@Zen Sepoil How do I configure dear ImGUI for macos, it shows linker error, also it is not able to recognize imgui.h functions
@ZenSepiol
@ZenSepiol Жыл бұрын
I have never tried it with macos, sorry.
@vinniciusrosa8284
@vinniciusrosa8284 Жыл бұрын
Rockstar North uses Dear Imgui for its engine. :)
@ZenSepiol
@ZenSepiol Жыл бұрын
That’s cool! Didn’t know that.
@MarcelBariou
@MarcelBariou Жыл бұрын
Thanks, I listen you carefully I learn something, I get your code through your presentation, it works perfectly I compile through CMake or code ::Blocks everything alright. Now, in a first time, I have an interactive console application, with infinite loop, I can select value to enter, start the application, collect data about the progress and so ..on, and finally 30 mn later I have the result (a C.S.V file) It tells me : Job completed ! . My ignorance about GUI is great! Where should I have to place my code or yours avoiding that the execution of imGUI suspends that of my code or vice versa. My code is simple, long to execute => {{ 1) Start, 2) Give it a variable value and it runs, 3) It indicates its progress 4) Finally job is finished, file C.S. V available!}} Thanks for a simple clarification, I am totally ignorant about GUI, with your setup Could you please tell me where and how to proceed ? Great thanks again! I have to learn and understand I need a GUI for the near future. A simple hint if possible.
@ZenSepiol
@ZenSepiol Жыл бұрын
You probably need a second thread for processing your data. You can start the thread when the button is pressed and only react on the result in the UI once the task is finished. I looked around but surprisingly I didn't find a good code example. If I find the time, I'll make one and a video about it.
@MarcelBariou
@MarcelBariou Жыл бұрын
@@ZenSepiol Ok thanks for your attention, I continue my investigations and my tests and as soon as it works I will come back to you, As far as I understand, I can open a window for each application that takes a long time to run and I can catch the standard I/O and pass also some data to the application Thank you!
@ZenSepiol
@ZenSepiol Жыл бұрын
@@MarcelBariou Have a look at kzfaq.info/get/bejne/mcqJqJyIubu1XXk.html :-)
@LazarenkoS
@LazarenkoS Жыл бұрын
How to scale this example on HDPI screen?
@ZenSepiol
@ZenSepiol Жыл бұрын
You should be able to scale the window here: github.com/ZenSepiol/Dockerized-Dear-ImGui/blob/main/src/lib/app_base/app_base.hpp#L32
@isodoubIet
@isodoubIet Ай бұрын
The Achilles heel of Dear ImGui is the font rendering. It's unacceptably bad. Subpixel rendering is an absolute must for any serious graphical UI.
@jonesy_b
@jonesy_b Жыл бұрын
hi, how do you run those install commands?
@ZenSepiol
@ZenSepiol Жыл бұрын
Which install commands do you mean? At which point in the video?
@jonesy_b
@jonesy_b Жыл бұрын
@@ZenSepiol at 3:06, I might have already figuree it out just need to test it but is it a package manager you need to download? Or is the Windows one in the terminal good enough? Never knew about these package manager things
@ZenSepiol
@ZenSepiol Жыл бұрын
I am using linux (kubuntu). This is the package manager from linux. Under windows you need to install this stuff yourself.
@jonesy_b
@jonesy_b Жыл бұрын
@@ZenSepiol ah ok thanks
@ultimatesoup
@ultimatesoup 8 ай бұрын
My main issue is how limited dear I'm gui is. There is no dispatch system which makes it impossible to subscribe to non standard events etc
@ZenSepiol
@ZenSepiol 8 ай бұрын
You are right, it might seem pretty bare-bone. Still there are lots of huge projects powered by it: github.com/ocornut/imgui/wiki/Software-using-dear-imgui
@ultimatesoup
@ultimatesoup 8 ай бұрын
@@ZenSepiol I think for many projects its enough just to know if a button was clicked for example, but its too limited for the GUI abstraction layer ive written for my Game engine.
@stefcozum1022
@stefcozum1022 2 жыл бұрын
Are you also using any alternatives for GUI creation?
@ZenSepiol
@ZenSepiol 2 жыл бұрын
I also use QT a lot.
@yourcommander3412
@yourcommander3412 Жыл бұрын
GTA IV - I feel like a real R* boy inside my shitty OpenGL window :)
@ZenSepiol
@ZenSepiol Жыл бұрын
A lot of modern games use OpenGL for rendering, e.g. FarCry, Counterstrike, COD … Keep going and the results go from meeeh to amazing pretty fast!
@museumofmoderncrap532
@museumofmoderncrap532 Жыл бұрын
how do u do do this on windows
@ZenSepiol
@ZenSepiol Жыл бұрын
Here is a good explanation to get it running on windows 10. stackoverflow.com/a/70255488/6858837
@ExactAimCC
@ExactAimCC Жыл бұрын
der macht einfach referat
@Henry-sv3wv
@Henry-sv3wv 11 ай бұрын
für die schule?
@ExactAimCC
@ExactAimCC 11 ай бұрын
@@Henry-sv3wv ja man
@duribv
@duribv Жыл бұрын
Hi, very much thanks for your ImGui tutorial. It really helped me to start a GUI project. I'd like to ask about one thing - can you remake the framework to "docking" branch of Dear ImGui please? I did everything like you showed here for the docking branch, but the issue is the new "ImGuiConfigFlags_ViewportsEnable" and subsequent if statement after rendering that handles windows outside. It gives me error: imgui.cpp:8940: void ImGui::ErrorCheckNewFrameSanityChecks(): Assertion `g.PlatformIO.Platform_CreateWindow != __null && "Platform init didn't install handlers?"' failed.
@ZenSepiol
@ZenSepiol Жыл бұрын
Yes, I plan an updated video. I already created a dockerized version of DearIm Gui which is based on the latest docking branch. Stay tuned!
@duribv
@duribv Жыл бұрын
@@ZenSepiol Ah, I didn't notice. 26 days ago :) But it is still under development, right? Just to let you know what I aim for - not only ImPlot, but I am trying to combine it with VTK (via "trlsmax/imgui-vtk" project) to be able to do even more visual tricks. All dependency handled by CMake and CPM. Just configure and run :) The only thing left is how to deal with the "ImGuiConfigFlags_ViewportsEnable" properly for the framework. I am looking forward to your next tutorial!
@ZenSepiol
@ZenSepiol Жыл бұрын
Yes, I currently don't have a lot of time, but I will be ready soon.
ImGui | Game Engine series
27:57
The Cherno
Рет қаралды 112 М.
Haha😂 Power💪 #trending #funny #viral #shorts
00:18
Reaction Station TV
Рет қаралды 14 МЛН
Неприятная Встреча На Мосту - Полярная звезда #shorts
00:59
Полярная звезда - Kuzey Yıldızı
Рет қаралды 7 МЛН
How to install WxWidgets 3.2.2.1 using CodeBlocks
13:36
Retrofuge
Рет қаралды 9 М.
CppCon 2016: Nicolas Guillemot “Dear imgui,"
3:48
CppCon
Рет қаралды 76 М.
Dear ImGui in Unreal Engine 5 with C++
25:52
Kyle Geske
Рет қаралды 10 М.
How to run C program in command prompt
0:58
Coding is Love
Рет қаралды 241 М.
ImGui + SFML Tutorial - Install & Basics
4:01
Victor Gordan
Рет қаралды 17 М.
How to write Thread Pools in C++
13:37
Zen Sepiol
Рет қаралды 7 М.
Immediate UI for My Game in C++
1:24:30
Tsoding Daily
Рет қаралды 19 М.
Lid hologram 3d
0:32
LEDG
Рет қаралды 8 МЛН