From 44cd8e39da53f1a2ac7608ecf891e935eebd7ba9 Mon Sep 17 00:00:00 2001 From: osheriff Date: Sun, 22 Sep 2019 12:52:36 +0200 Subject: [PATCH] Automatically include the available gl loader header --- examples/imgui_impl_opengl3.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/imgui_impl_opengl3.h b/examples/imgui_impl_opengl3.h index 0f7eef74..fbf2417c 100644 --- a/examples/imgui_impl_opengl3.h +++ b/examples/imgui_impl_opengl3.h @@ -32,7 +32,19 @@ && !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \ && !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \ && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) -#define IMGUI_IMPL_OPENGL_LOADER_GL3W + // to avoid problem with non-clang compilers not having this macro. + #if defined(__has_include) + // check if the header exists, then automatically define the macros .. + #if __has_include() + #define IMGUI_IMPL_OPENGL_LOADER_GLEW + #elif __has_include() + #define IMGUI_IMPL_OPENGL_LOADER_GLAD + #else + #define IMGUI_IMPL_OPENGL_LOADER_GL3W + #endif + #else + #define IMGUI_IMPL_OPENGL_LOADER_GL3W + #endif #endif IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);