From ed94edfd8ee0b5aab34ba6326c0e6c3ada3de281 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 22 Mar 2015 14:14:23 +0000 Subject: [PATCH] Examples: Terser code + added commented out glUseProgram(0( suggestion in OpenGL2 sample. --- examples/opengl3_example/imgui_impl_glfw_gl3.cpp | 10 +--------- examples/opengl_example/imgui_impl_glfw.cpp | 11 ++--------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp index 53c13afe4..1cd2faf00 100644 --- a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp +++ b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp @@ -352,15 +352,7 @@ void ImGui_ImplGlfwGL3_NewFrame() g_MouseWheel = 0.0f; // Hide/show hardware mouse cursor - if (io.MouseDrawCursor) - { - // imgui draws cursor itself - glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); - } - else - { - glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); - } + glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL); // Start the frame ImGui::NewFrame(); diff --git a/examples/opengl_example/imgui_impl_glfw.cpp b/examples/opengl_example/imgui_impl_glfw.cpp index 9ea00a4dd..8c9cb2169 100644 --- a/examples/opengl_example/imgui_impl_glfw.cpp +++ b/examples/opengl_example/imgui_impl_glfw.cpp @@ -41,6 +41,7 @@ static void ImGui_ImplGlfw_RenderDrawLists(ImDrawList** const cmd_lists, int cmd glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glEnable(GL_TEXTURE_2D); + //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context // Setup orthographic projection matrix const float width = ImGui::GetIO().DisplaySize.x; @@ -256,15 +257,7 @@ void ImGui_ImplGlfw_NewFrame() g_MouseWheel = 0.0f; // Hide/show hardware mouse cursor - if (io.MouseDrawCursor) - { - // imgui draws cursor itself - glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); - } - else - { - glfwSetInputMode(g_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); - } + glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL); // Start the frame ImGui::NewFrame();