From 0ada71618429056db566c1ead7a8b4e5f29e23a7 Mon Sep 17 00:00:00 2001 From: omar Date: Sat, 25 Aug 2018 20:15:18 +0200 Subject: [PATCH] Examples: Viewport: Disabling swap intervals / vsync on secondary context to match what the DX11 bindings is doing. (#1542) --- examples/imgui_impl_glfw.cpp | 5 +++++ examples/imgui_impl_sdl.cpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp index e1138129..bf178a5b 100644 --- a/examples/imgui_impl_glfw.cpp +++ b/examples/imgui_impl_glfw.cpp @@ -391,6 +391,11 @@ static void ImGui_ImplGlfw_CreateWindow(ImGuiViewport* viewport) glfwSetWindowCloseCallback(data->Window, ImGui_ImplGlfw_WindowCloseCallback); glfwSetWindowPosCallback(data->Window, ImGui_ImplGlfw_WindowPosCallback); glfwSetWindowSizeCallback(data->Window, ImGui_ImplGlfw_WindowSizeCallback); + if (g_ClientApi == GlfwClientApi_OpenGL) + { + glfwMakeContextCurrent(data->Window); + glfwSwapInterval(0); + } } static void ImGui_ImplGlfw_DestroyWindow(ImGuiViewport* viewport) diff --git a/examples/imgui_impl_sdl.cpp b/examples/imgui_impl_sdl.cpp index d95f74a5..ef174d9a 100644 --- a/examples/imgui_impl_sdl.cpp +++ b/examples/imgui_impl_sdl.cpp @@ -369,7 +369,10 @@ static void ImGui_ImplSDL2_CreateWindow(ImGuiViewport* viewport) data->Window = SDL_CreateWindow("No Title Yet", (int)viewport->Pos.x, (int)viewport->Pos.y, (int)viewport->Size.x, (int)viewport->Size.y, sdl_flags); data->WindowOwned = true; if (use_opengl) + { data->GLContext = SDL_GL_CreateContext(data->Window); + SDL_GL_SetSwapInterval(0); + } if (use_opengl && backup_context) SDL_GL_MakeCurrent(data->Window, backup_context); viewport->PlatformHandle = (void*)data->Window;