ImGui multi-windows with Cinder

Hi,
I am trying to have floating window outside of my main window in cinder while using imgui using the Viewport config Flag. If I run a default non cinder app from the imgui sample, I can get one floating window outside of the main window.

If I add the same Demo Window to one of the samples from cinder which includes imgui (like tubular), I don’t get the same result, even with the same imgui version (imgui v1.88 WIP docking branch).

I tried to start from an example ImGui example, adding this in the setup function:

io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;           // Enable Docking
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;         // Enable Multi-Viewport / Platform Windows

And in the update function, at the end:

ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();

But I am always getting the same error message:
image

Anybody has found a solution for that?
Thanks for the help

1 Like

I have this working properly in my personal Cinder fork. I need to sync with upstream but this should point you in the right direction at least.

I initialize ImGui like this:

auto opts = ImGui::Options().enableViewports(true);
ImGui::Initialize(opts);

I’m a little hazy on the details of what needed changing but this has been working well for me the last year or so. I did have one instance on a machine where every external window would just be drawn as a black rectangle, but haven’t been able to dive into that specific instance. The same application was working fine on other machines which makes me suspect it was a graphics driver issue or something along those lines.

Another issue I had until yesterday: it seemed like if vsync was enabled the app would normally run nicely at 60fps, but if 1 or more external windows were being drawn the framerate would drop to 30fps. I wouldn’t call it a “fix” per se but it seems like this issue disappears when not swapping buffers:

Let me know if you get it working

edit:
Forgot I actually added a DockingUI sample project

1 Like

Hi,

Thanks for posting this and pointing to your repo.

I too am interested in this.

When I clone your repo and try to build the DockingUI sample, first you are missing a couple of get* functions. After fixing that, it compiles but won’t link due to a bunch of unresolved references to ImGui:: functions (eg. ImGui::BeginTable, ImGui::EndTable, ImGui::TableNextColumn, …).

I thought ImGui was built into Cinder and didn’t need any separate compilation of the library. Are you using a different ImGui library? Where can I get that?

Thanks,
Clay Budin

I figured it out. Your vc2019 solution for cinder was missing the source file imgui_tables.cpp

Cheers,
Clay Budin