1

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.

McBear Holden
  • 805
  • 4
  • 14

1 Answers1

0

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: https://github.com/seanchas116/qtimgui

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

nada
  • 2,109
  • 2
  • 16
  • 23