|
|
@ -14,6 +14,7 @@ |
|
|
|
|
|
|
|
// CHANGELOG
|
|
|
|
// (minor and older changes stripped away, please see git history for details)
|
|
|
|
// 2023-05-09: OpenGL: Support for glBindSampler() backup/restore on ES3. (#6375)
|
|
|
|
// 2023-04-18: OpenGL: Restore front and back polygon mode separately when supported by context. (#6333)
|
|
|
|
// 2023-03-23: OpenGL: Properly restoring "no shader program bound" if it was the case prior to running the rendering function. (#6267, #6220, #6224)
|
|
|
|
// 2023-03-15: OpenGL: Fixed GL loader crash when GL_VERSION returns NULL. (#6154, #4445, #3530)
|
|
|
@ -176,8 +177,8 @@ |
|
|
|
#define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET |
|
|
|
#endif |
|
|
|
|
|
|
|
// Desktop GL 3.3+ has glBindSampler()
|
|
|
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_3) |
|
|
|
// Desktop GL 3.3+ and GL ES 3.0+ have glBindSampler()
|
|
|
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) && (defined(IMGUI_IMPL_OPENGL_ES3) || defined(GL_VERSION_3_3)) |
|
|
|
#define IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER |
|
|
|
#endif |
|
|
|
|
|
|
@ -434,8 +435,8 @@ static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_wid |
|
|
|
glUniformMatrix4fv(bd->AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]); |
|
|
|
|
|
|
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER |
|
|
|
if (bd->GlVersion >= 330) |
|
|
|
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
|
|
|
|
if (bd->GlVersion >= 330 || bd->GlProfileIsES3) |
|
|
|
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 and GL ES 3.0 may set that otherwise.
|
|
|
|
#endif |
|
|
|
|
|
|
|
(void)vertex_array_object; |
|
|
@ -473,7 +474,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data) |
|
|
|
GLuint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program); |
|
|
|
GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture); |
|
|
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER |
|
|
|
GLuint last_sampler; if (bd->GlVersion >= 330) { glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&last_sampler); } else { last_sampler = 0; } |
|
|
|
GLuint last_sampler; if (bd->GlVersion >= 330 || bd->GlProfileIsES3) { glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&last_sampler); } else { last_sampler = 0; } |
|
|
|
#endif |
|
|
|
GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer); |
|
|
|
#ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY |
|
|
@ -600,7 +601,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data) |
|
|
|
if (last_program == 0 || glIsProgram(last_program)) glUseProgram(last_program); |
|
|
|
glBindTexture(GL_TEXTURE_2D, last_texture); |
|
|
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER |
|
|
|
if (bd->GlVersion >= 330) |
|
|
|
if (bd->GlVersion >= 330 || bd->GlProfileIsES3) |
|
|
|
glBindSampler(0, last_sampler); |
|
|
|
#endif |
|
|
|
glActiveTexture(last_active_texture); |
|
|
|