Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of viewports with existing windows #4298

Open
vaspoul opened this issue Jul 7, 2021 · 1 comment
Open

Use of viewports with existing windows #4298

vaspoul opened this issue Jul 7, 2021 · 1 comment

Comments

@vaspoul
Copy link

vaspoul commented Jul 7, 2021

Hi, I was wondering if there's been any discussions about using the viewports feature but in a scenario where the platform windows are owned and maintained by the application. This would happen for example when retrofitting Dear ImGui onto an existing application, which already has a framework of creating, moving and docking (platform) windows and would like to use ImGui for additional rendering.

One approach would be to keep each platform window completely indepenent and give it its own ImGui context, without using the docking branch. This would work for truly independent content, but breaks down if you'd like to implement drag & drop of items (not ImGui windows) from one platform window to another.

The docking branch would get us very close, as it has a single context and maintains separate draw lists for each viewport. What would be needed is a way for the application to register its platform windows (and a viewport per window) with ImGui, as well as functions to update them (e.g. when the window is moved/resized).

The scenario I'm describing is probably well outside the scope of the docking/viewport branch, but if there any suggestions on what I should watch out for if I was to try and do this myself that would be super helpful!

#1542

@cfillion
Copy link
Contributor

cfillion commented Jul 10, 2021

Docking Dear ImGui windows into a parent application dock can be done by creating a Dear ImGui window and DockSpace pair for each of the parent application's docks. Then the backend code perform any necessary special handling for docking into the parent application when initializing the DockSpace's parent window's viewport.

I use this technique in ReaImGui for docking Dear ImGui windows into REAPER's docks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants