Also with yours the button is on the imgui window the not the opengl window
How to make buttons in ImGui in OpenGL with glfw
ImGUI uses OpenGL to draw gui's elements. ImGUI uses GLFW (and SDL2) for window. You can add your glDrawArrays/glDrawElements command to this example: https://github.com/ocornut/imgui/blob/master/examples/example_glfw_opengl3/main.cpp
Box2D 2.4.0 was released 12 days ago. Testbed uses ImGUI, GLFW, GLAD and OpenGL 3.3. It is great because previous release was in on Apr 6, 2014. I built it today using CMake and MinGW 8.1.0 32-bit. Now Box2D has unit tests that your can run by yourself. We can study how ImGUI is used in Testbed.
![](https://uploads.gamedev.net/forums/monthly_2020_08/482984d82aa847a2a933cdfe065240d4.Box2DAndCMake.png)
If you want to run Testbed on laptop you need to run “E:\Libs\box2d-2.4.0\dist\testbed\testbed.exe” using “High performance graphics processor” (instead of “Integrated graphics processor” because Testbed requires OpenGL 3.3. You should to click by RMB on "testbed.exe" and choose “Run with graphics processor” → “High performance graphics processor”
![](https://uploads.gamedev.net/forums/monthly_2020_08/d51d05da5c1944b7928ea2378ff27ced.Box2DTestbedChainExample.png)
8Observer8 said:
ImGUI uses … SDL2 for window.
Not necessarily, in a Qt environment perhaps you are, though…
SuperVGA said:
Not necessarily, in a Qt environment perhaps you are, though…
Sometimes I use QtCreator IDE for pure C++ (GLFW and SDL2) but Qt GUI (QtWidgets and QML) has more priority for me because it allows to make GUI apps with 3D OpenGL graphics very easy (Qt has a lot of helper classes). I think the topic starter does not uses Qt framework. But I showed above how to setup ImGUI in QtCreator without Qt Framework. I think it is possible to install QtCreator + MinGW without Qt. I deleted Visual Studio 2019 because it is require a lot of space on my laptop. I think it is ~20 GB. QtCreator+MinGW require 1GB. Whole Qt SDK (+QtCreate+MinGW) requires 2.22 GB (without Android and iOS). But a lot of books and tutorials use GLFW. SDL2 supports 2D audio very easy. I like to study a few technologies to choose what is better for current task.
@8Observer8 Thanks guys. I just found out that the imgui window is inside of the opengl window and it is not movable
Edit: Is the imgui window allow to place buttons on x,y positions. I know it allows me to place buttons but does it also allow the window positions
@undefined Like if we click on a app on a phone we just load in. We dont have to go to iPhone imgui screen. So I wanted to make a buttons on the opengl screen
Shaanveer said:
@undefined Like if we click on a app on a phone we just load in. We dont have to go to iPhone imgui screen. So I wanted to make a buttons on the opengl screen
Could you please provide a visual mockup of what you're trying to do (upload an image via imgur.com, for instance, and post the link here)
There is a lot of terms in software development, and you have chosen to dive right into the deep end. You're not going to learn it all overnight, and it's understandable that it can be difficult to do what you want. Visuals help convey this.
Again, and this has nothing to do with visuals, I must advise that you drop C++ and opengl for now, and use Godot. You're 11, you'll get into the advanced stuff eventually.
I don't understand this fixation on positions. Any GUI library will have ways to position and size things. Many will do a lot of the layout for you to avoid having to manually enter x,y positions and sizes, which keeping consistent alignment, padding etc., but you can generally still “force” a position/size of some element if you really need to for some reason.
Shaanveer said:
@8Observer8 Thanks guys. I just found out that the imgui window is inside of the opengl window and it is not movable
As for Windows being movable, that is generally an option in most UI libraries to allow moving by dragging a title bar or such (EDIT: Infact, it should be default in ImGui, `ImGuiWindowFlags_NoMove` optionally disables a window from being movable).
SuperVGA said:
Could you please provide a visual mockup of what you're trying to do (upload an image via imgur.com, for instance, and post the link here)
You can attach images directly on the forum, both by pasting from the clipboard into the post, or by the “insert image” button.
![](https://uploads.gamedev.net/forums/monthly_2020_08/a727703c2fd84b9791824f3fc0fb3378.image.png)
@SuperVGA https://nklein.com/2009/11/playing-with-sheeple-based-gui-atop-cl-opengl/
Check the picture out. Example for this would be a calculator. Buttons and answer on same screen not different windows