[Scummvm-git-logs] scummvm master -> 39efaa54d59ef2a5ca010a608c3b952ec7fe7e2d
lephilousophe
noreply at scummvm.org
Sun Feb 16 17:46:10 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
37305ba22c SDL: Allow to use ImGui with a GLES2 context
39efaa54d5 IMGUI: Use the static loader if we are not using GLAD
Commit: 37305ba22c95c6c7b04b3fd61418f58d1bd91225
https://github.com/scummvm/scummvm/commit/37305ba22c95c6c7b04b3fd61418f58d1bd91225
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-02-16T18:43:41+01:00
Commit Message:
SDL: Allow to use ImGui with a GLES2 context
Init ImGui after our GLContext object has been initialized and check the
context type to specify the proper GLSL version.
Also make sure we are not in GLES mode before setuping ImGui.
Changed paths:
backends/graphics/openglsdl/openglsdl-graphics.cpp
backends/graphics/sdl/sdl-graphics.cpp
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 35dd7e3101d..0a97b912efd 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -622,11 +622,6 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
return false;
}
-#ifdef USE_IMGUI
- // Setup Dear ImGui
- initImGui(nullptr, _glContext);
-#endif
-
if (SDL_GL_SetSwapInterval(_vsync ? 1 : 0)) {
warning("Unable to %s VSync: %s", _vsync ? "enable" : "disable", SDL_GetError());
}
@@ -637,6 +632,11 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
handleResize(actualWidth, actualHeight);
+#ifdef USE_IMGUI
+ // Setup Dear ImGui
+ initImGui(nullptr, _glContext);
+#endif
+
#ifdef WIN32
// WORKAROUND: Prevent (nearly) offscreen positioning of the ScummVM window by forcefully
// trigger a re-positioning event to center the window.
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index e2fd1e9342a..d57fd73fe26 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -592,6 +592,13 @@ void SdlGraphicsManager::initImGui(SDL_Renderer *renderer, void *glContext) {
_imGuiSDLRenderer = nullptr;
#ifdef USE_OPENGL
if (!_imGuiReady && glContext) {
+ // Only OpenGL and GLES2 are supported, not GLES
+ if ((OpenGLContext.type != OpenGL::kContextGL) &&
+ (OpenGLContext.type != OpenGL::kContextGLES2)) {
+ ImGui::DestroyContext();
+ return;
+ }
+
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
if (!ImGui_ImplSDL2_InitForOpenGL(_window->getSDLWindow(), glContext)) {
@@ -599,7 +606,13 @@ void SdlGraphicsManager::initImGui(SDL_Renderer *renderer, void *glContext) {
return;
}
- if (!ImGui_ImplOpenGL3_Init("#version 110")) {
+ const char *glslVersion;
+ if (OpenGLContext.type == OpenGL::kContextGLES2) {
+ glslVersion = "#version 100";
+ } else {
+ glslVersion = "#version 110";
+ }
+ if (!ImGui_ImplOpenGL3_Init(glslVersion)) {
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
return;
Commit: 39efaa54d59ef2a5ca010a608c3b952ec7fe7e2d
https://github.com/scummvm/scummvm/commit/39efaa54d59ef2a5ca010a608c3b952ec7fe7e2d
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-02-16T18:44:23+01:00
Commit Message:
IMGUI: Use the static loader if we are not using GLAD
Fixes bug:15541.
Changed paths:
configure
diff --git a/configure b/configure
index 483c445cdd3..95f073d598d 100755
--- a/configure
+++ b/configure
@@ -6887,6 +6887,15 @@ else
echo "$_imgui"
fi
+# When GLAD is not available (in emscripten for example), make ImGui use GLES2 statically
+if test "$_imgui" = "yes" -a "$_opengl_glad" != yes; then
+ case $_opengl_mode in
+ gles2)
+ append_var DEFINES "-DIMGUI_IMPL_OPENGL_ES2"
+ ;;
+ esac
+fi
+
#
# Enable vkeybd / event recorder
#
More information about the Scummvm-git-logs
mailing list