From 00e29832d4ce37673bfcc4054014ccc95a2fc79a Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 3 Aug 2018 15:04:35 +0200 Subject: [PATCH] Examples: OpenGL2: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications. (#1996) --- CHANGELOG.txt | 1 + examples/imgui_impl_opengl2.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 55948c31..7b5987b9 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -75,6 +75,7 @@ Other Changes: - Examples: OpenGL3: Tweaked the imgui_impl_opengl3.cpp to work as-is with Emscripten + WebGL 2.0. (#1941). [@o-micron] - Examples: OpenGL3: Made the example app default to GL 3.0 + GLSL 130 (instead of GL 3.2 + GLSL 150) unless on Mac. - Examples: OpenGL3: Added error output when shaders fail to compile/link. + - Examples: OpenGL2: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications. (#1996) - Examples: DirectX10, DirectX11: Fixed unreleased resources in Init and Shutdown functions. (#1944) - Examples: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility. (#1989) [@matt77hias] - Examples: Win32, Glfw, SDL: Added support for the ImGuiMouseCursor_Hand cursor. diff --git a/examples/imgui_impl_opengl2.cpp b/examples/imgui_impl_opengl2.cpp index e584c072..c70d9fe6 100644 --- a/examples/imgui_impl_opengl2.cpp +++ b/examples/imgui_impl_opengl2.cpp @@ -18,6 +18,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2018-08-03: OpenGL: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications. // 2018-06-08: Misc: Extracted imgui_impl_opengl2.cpp/.h away from the old combined GLFW/SDL+OpenGL2 examples. // 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle. // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplGlfwGL2_RenderDrawData() in the .h file so you can call it yourself. @@ -90,6 +91,8 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + glDisable(GL_COLOR_MATERIAL); glEnable(GL_SCISSOR_TEST); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);