diff --git a/core/application/application.cpp b/core/application/application.cpp index 8a3e6e7..5db39e7 100644 --- a/core/application/application.cpp +++ b/core/application/application.cpp @@ -117,6 +117,8 @@ void application::init_imgui() { ImGuiIO& io = ImGui::GetIO(); io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls + io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking + io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows ImGui::StyleColorsDark(); //ImGui::StyleColorsLight(); } diff --git a/core/rhi/opengl/renderer_opengl.cpp b/core/rhi/opengl/renderer_opengl.cpp index 18217c3..2dfdcff 100644 --- a/core/rhi/opengl/renderer_opengl.cpp +++ b/core/rhi/opengl/renderer_opengl.cpp @@ -88,6 +88,8 @@ void renderer_opengl::new_frame(GLFWwindow* window_handle) { } void renderer_opengl::end_frame(GLFWwindow* window_handle) { + const ImGuiIO& io = ImGui::GetIO(); + // Rendering ImGui::Render(); int display_w, display_h; @@ -98,6 +100,17 @@ void renderer_opengl::end_frame(GLFWwindow* window_handle) { glClear(GL_COLOR_BUFFER_BIT); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); + // Update and Render additional Platform Windows + // (Platform functions may change the current OpenGL context, so we save/restore it to make it easier to paste this code elsewhere. + // For this specific demo app we could also call glfwMakeContextCurrent(window) directly) + if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) + { + GLFWwindow* backup_current_context = glfwGetCurrentContext(); + ImGui::UpdatePlatformWindows(); + ImGui::RenderPlatformWindowsDefault(); + glfwMakeContextCurrent(backup_current_context); + } + glfwSwapBuffers(window_handle); } diff --git a/third_party/imgui/imgui b/third_party/imgui/imgui index 96839b4..8048b52 160000 --- a/third_party/imgui/imgui +++ b/third_party/imgui/imgui @@ -1 +1 @@ -Subproject commit 96839b445e32e46d87a44fd43a9cdd60c806f7e1 +Subproject commit 8048b52498a9bf2a9f87b080d43b0bfd7a5d51d8