diff --git a/examples/imgui_impl_sdl.cpp b/examples/imgui_impl_sdl.cpp index 32ac4022..8d52a212 100644 --- a/examples/imgui_impl_sdl.cpp +++ b/examples/imgui_impl_sdl.cpp @@ -74,6 +74,7 @@ static bool g_MousePressed[3] = { false, false, false }; static SDL_Cursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = {}; static char* g_ClipboardTextData = NULL; static bool g_MouseCanUseGlobalState = true; +static bool g_UseVulkan = false; // Forward Declarations static void ImGui_ImplSDL2_InitPlatformInterface(SDL_Window* window, void* sdl_gl_context); @@ -240,6 +241,7 @@ bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window) #if !SDL_HAS_VULKAN IM_ASSERT(0 && "Unsupported"); #endif + g_UseVulkan = true; return ImGui_ImplSDL2_Init(window, NULL); } @@ -467,7 +469,7 @@ static void ImGui_ImplSDL2_CreateWindow(ImGuiViewport* viewport) } Uint32 sdl_flags = 0; - sdl_flags |= use_opengl ? SDL_WINDOW_OPENGL : SDL_WINDOW_VULKAN; + sdl_flags |= use_opengl ? SDL_WINDOW_OPENGL : (g_UseVulkan ? SDL_WINDOW_VULKAN : 0); sdl_flags |= SDL_GetWindowFlags(g_Window) & SDL_WINDOW_ALLOW_HIGHDPI; sdl_flags |= SDL_WINDOW_HIDDEN; sdl_flags |= (viewport->Flags & ImGuiViewportFlags_NoDecoration) ? SDL_WINDOW_BORDERLESS : 0;