Skip to content

Commit eeb81d7

Browse files
committed
update imgui and implot
1 parent 701316b commit eeb81d7

26 files changed

+6494
-4608
lines changed

3rdparty/imgui/examples/imgui_impl_glfw.cpp renamed to 3rdparty/imgui/backends/imgui_impl_glfw.cpp

Lines changed: 108 additions & 71 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui: Platform Binding for GLFW
1+
// dear imgui: Platform Backend for GLFW
22
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
33
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
44

@@ -9,26 +9,33 @@
99
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
1010
// [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
1111

12-
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
13-
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
14-
// https://github.com/ocornut/imgui
12+
// Issues:
13+
// [ ] Platform: Multi-viewport support: ParentViewportID not honored, and so io.ConfigViewportsNoDefaultParent has no effect (minor).
14+
15+
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
16+
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
17+
// Read online: https://github.com/ocornut/imgui/tree/master/docs
1518

1619
// About GLSL version:
1720
// The 'glsl_version' initialization parameter defaults to "#version 150" if NULL.
1821
// Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure!
1922

2023
#pragma once
24+
#include "imgui.h" // IMGUI_IMPL_API
2125

2226
struct GLFWwindow;
27+
struct GLFWmonitor;
2328

2429
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
2530
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks);
2631
IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
2732
IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
2833

29-
// InitXXX function with 'install_callbacks=true': install GLFW callbacks. They will call user's previously installed callbacks, if any.
30-
// InitXXX function with 'install_callbacks=false': do not install GLFW callbacks. You will need to call them yourself from your own GLFW callbacks.
34+
// GLFW callbacks
35+
// - When calling Init with 'install_callbacks=true': GLFW callbacks will be installed for you. They will call user's previously installed callbacks, if any.
36+
// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call those function yourself from your own GLFW callbacks.
3137
IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
3238
IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
3339
IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
3440
IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
41+
IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event);

3rdparty/imgui/examples/imgui_impl_opengl3.cpp renamed to 3rdparty/imgui/backends/imgui_impl_opengl3.cpp

Lines changed: 121 additions & 85 deletions
Large diffs are not rendered by default.
Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
// dear imgui: Renderer for modern OpenGL with shaders / programmatic pipeline
1+
// dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline
22
// - Desktop GL: 2.x 3.x 4.x
33
// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
4-
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
4+
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
55

66
// Implemented features:
77
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
88
// [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
99
// [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bit indices.
1010

11-
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
12-
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
13-
// https://github.com/ocornut/imgui
11+
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
12+
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
13+
// Read online: https://github.com/ocornut/imgui/tree/master/docs
1414

1515
// About Desktop OpenGL function loaders:
16-
// Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
16+
// Modern Desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
1717
// Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad).
1818
// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
1919

@@ -23,6 +23,7 @@
2323
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
2424

2525
#pragma once
26+
#include "imgui.h" // IMGUI_IMPL_API
2627

2728
// Backend API
2829
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
@@ -36,33 +37,52 @@ IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture();
3637
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
3738
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
3839

39-
// Specific OpenGL versions
40+
// Specific OpenGL ES versions
4041
//#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten
4142
//#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android
4243

43-
// Desktop OpenGL: attempt to detect default GL loader based on available header files.
44+
// Attempt to auto-detect the default Desktop GL loader based on available header files.
4445
// If auto-detection fails or doesn't select the same GL loader file as used by your application,
4546
// you are likely to get a crash in ImGui_ImplOpenGL3_Init().
46-
// You can explicitly select a loader by using '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
47-
#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
47+
// You can explicitly select a loader by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
48+
#if !defined(IMGUI_IMPL_OPENGL_ES2) \
49+
&& !defined(IMGUI_IMPL_OPENGL_ES3) \
50+
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
4851
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
4952
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
50-
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING) \
53+
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD2) \
54+
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) \
55+
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) \
5156
&& !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
52-
#if defined(__has_include)
53-
#if __has_include(<GL/glew.h>)
54-
#define IMGUI_IMPL_OPENGL_LOADER_GLEW
55-
#elif __has_include(<glad/glad.h>)
56-
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
57-
#elif __has_include(<GL/gl3w.h>)
58-
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
59-
#elif __has_include(<glbinding/gl/gl.h>)
60-
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING
61-
#else
62-
#error "Cannot detect OpenGL loader!"
63-
#endif
64-
#else
65-
#define IMGUI_IMPL_OPENGL_LOADER_GL3W // Default to GL3W
66-
#endif
57+
58+
// Try to detect GLES on matching platforms
59+
#if defined(__APPLE__)
60+
#include "TargetConditionals.h"
6761
#endif
62+
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
63+
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
64+
#elif defined(__EMSCRIPTEN__)
65+
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
6866

67+
// Otherwise try to detect supported Desktop OpenGL loaders..
68+
#elif defined(__has_include)
69+
#if __has_include(<GL/glew.h>)
70+
#define IMGUI_IMPL_OPENGL_LOADER_GLEW
71+
#elif __has_include(<glad/glad.h>)
72+
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
73+
#elif __has_include(<glad/gl.h>)
74+
#define IMGUI_IMPL_OPENGL_LOADER_GLAD2
75+
#elif __has_include(<GL/gl3w.h>)
76+
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
77+
#elif __has_include(<glbinding/glbinding.h>)
78+
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING3
79+
#elif __has_include(<glbinding/Binding.h>)
80+
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING2
81+
#else
82+
#error "Cannot detect OpenGL loader!"
83+
#endif
84+
#else
85+
#define IMGUI_IMPL_OPENGL_LOADER_GL3W // Default to GL3W embedded in our repository
86+
#endif
87+
88+
#endif

3rdparty/imgui/examples/example_glfw_opengl3/main.cpp

Lines changed: 0 additions & 225 deletions
This file was deleted.

0 commit comments

Comments
 (0)