Open yockey88 opened 1 year ago
You don't set up a dockspace in your code, you must do so by either calling ImGui::DockSpace()
or ImGui::DockSpaceOverViewport()
, see demo code for reference.
Also, calling ImGui::SetNextWindowPos/Size/Viewport()
every frame could mess with things further. Maybe set ImGuiCond_FirstUseEver
to restrict it to the first use, then let ImGui handle the docking.
There are multiple things here:
Indeed you didn't setup a dockspace but a regular window: technically that will allow docking into but that's not what you want (for reasons I won't detail here). But your main problem is you are calling SetNextWindowPos() every frame on it effectively UNDOCK that "ye2" window, so in turns the Demo Window become the sole window and take the full space. If you open Tools->Debug Log->Docking you'll see notification of "ye2" being undocked.
Using DockSpaceOverViewport()
is going to be simpler and more correct anyway so use that.
About the "dull grey and lose color" thing, This seem to be an issue with your multi-viewport .
Hi sorry I forgot to check this so I'm just seeing these, I'll fix the Dockspace stuff, but the greying out of the viewport happens both in this mini example and the unmodified app, I attached a video of the actual application where this happens. And for version number, 1.89.9 is what appears on my Imgui Demo Window I'm using for reference. I attached an image of that as well. So that is what I put, I'll try out the dockspace stuff and see effect that has
https://github.com/ocornut/imgui/assets/64506168/89badc86-d511-4664-a79d-2bdb5725a7c4
Edit: I went and used the example code for DockSpaceOverViewport(GetMainViewPort()) and unfortunately that just turned my entire window gray, and while that fixes the docking issue it just turns my entire window gray. I'm trying to make the bottom layer window see through so I can display 'floating' text and stuff on the scene. Setting the ImGuiWindowFlags_NoBackground doesn't seem to have any effect, simply making my window one giant grey square. Is there a way I can make a see through dockspace that is the same size as the platform window? There seems to be a lot of discussion about the subject but none of the solutions here have worked for me.
Edit 2: I Fixed the docking issue with your suggestions thank you for the tips on how to use dockspace, however using both of the DockSpace functions seems to turn off the NoBackground window flag, and the viewport issue also remains. I attached a video of the update with the dockspace calls.
https://github.com/ocornut/imgui/assets/64506168/c655d6f7-0591-4737-8947-e199f3e90bca
Version/Branch of Dear ImGui:
Version: 1.89.9 Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp Compiler: MSVC (cl) Operating System: Win32 (Windows 11)
My Issue/Question:
Attempting to dock an imgui on the main viewport causes it to fill the whole screen and not the side I attempted to dock it to and was highlighted initially. As well it seems to fill a space larger than the the actual viewport hanging off the bottom of the window. Also whenever I drag an imgui window outside of the main window, it becomes a dull gray and loses color.
I've tested using a few flags and giving the bottom layer imgui window thats clear and immovable different flags and different sizes but nothing seems to work.
Screenshots/Video
https://github.com/ocornut/imgui/assets/64506168/ec9a21fa-5d37-4842-a2a1-25fef7bb8b3a
Minimal Reproducible Example