Dear ImGui window fits background

How to make a Dear ImGui - created window fit exactly the "background" ? I mean when we create a window, it's also inside some rendering scene or background. I want to imitate windows created by other frameworks such as Qt to make it more desktop application like, not only inside some games.

1 Answer

ImGui can not create the 'rendering scene' or 'background' as you call it on its own, it has to hook into another framework that can. This is why you cannot have an ImGui window as 'host' window. But since you mentioned Qt, you could use that as the Desktop-like host environment and hook ImGui into it. An example of how to achieve this would be:

class DemoWindow : public QOpenGLWindow
{
protected: void initializeGL() override { QtImGui::initialize(this); } void paintGL() override { // you can do custom GL rendering as well in paintGL QtImGui::newFrame(); ImGui::Text("Hello"); // more widgets... ImGui::Render(); }
};

Source:

Obviously you would have to also include the qtimgui library into your project.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like