|
@@ -1,5 +1,5 @@
|
|
|
// dear imgui: Renderer for modern OpenGL with shaders / programmatic pipeline
|
|
|
-// - Desktop GL: 3.x 4.x
|
|
|
+// - Desktop GL: 2.x 3.x 4.x
|
|
|
// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
|
|
|
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
|
|
|
|
@@ -23,37 +23,42 @@
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
+// Backend API
|
|
|
+IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
|
|
+IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
|
|
+IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
|
|
|
+IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
|
|
+
|
|
|
+// (Optional) Called by Init/NewFrame/Shutdown
|
|
|
+IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture();
|
|
|
+IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture();
|
|
|
+IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
|
|
|
+IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
|
|
+
|
|
|
// Specific OpenGL versions
|
|
|
//#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten
|
|
|
//#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android
|
|
|
|
|
|
-// Set default OpenGL3 loader to be gl3w
|
|
|
-#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
|
|
- && !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
|
|
- && !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
|
|
|
+// Desktop OpenGL: attempt to detect default GL loader based on available header files.
|
|
|
+// If auto-detection fails or doesn't select the same GL loader file as used by your application,
|
|
|
+// you are likely to get a crash in ImGui_ImplOpenGL3_Init().
|
|
|
+// You can explicitly select a loader by using '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
|
|
|
+#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
|
|
+ && !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
|
|
+ && !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
|
|
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
|
|
- // 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(<GL/glew.h>)
|
|
|
#define IMGUI_IMPL_OPENGL_LOADER_GLEW
|
|
|
#elif __has_include(<glad/glad.h>)
|
|
|
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
|
|
|
- #else
|
|
|
+ #elif __has_include(<GL/gl3w.h>)
|
|
|
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
|
|
|
+ #else
|
|
|
+ #error "Cannot detect OpenGL loader!"
|
|
|
#endif
|
|
|
#else
|
|
|
- #define IMGUI_IMPL_OPENGL_LOADER_GL3W
|
|
|
+ #define IMGUI_IMPL_OPENGL_LOADER_GL3W // Default to GL3W
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
-IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
|
|
-IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
|
|
-IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
|
|
|
-IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
|
|
-
|
|
|
-// Called by Init/NewFrame/Shutdown
|
|
|
-IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture();
|
|
|
-IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture();
|
|
|
-IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
|
|
|
-IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|