mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 05:27:01 +00:00
Backends: OpenGL3: Add glBindSampler for GL ES 3.0. (#6375)
Amended given addition of GlProfileIsES3 in dd9db5e
This commit is contained in:
parent
dd9db5e889
commit
39f7248d4a
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (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-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-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)
|
// 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
|
#define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Desktop GL 3.3+ has glBindSampler()
|
// 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)
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) && (defined(IMGUI_IMPL_OPENGL_ES3) || defined(GL_VERSION_3_3))
|
||||||
#define IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
#define IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||||
#endif
|
#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]);
|
glUniformMatrix4fv(bd->AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
||||||
|
|
||||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||||
if (bd->GlVersion >= 330)
|
if (bd->GlVersion >= 330 || bd->GlProfileIsES3)
|
||||||
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
|
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 and GL ES 3.0 may set that otherwise.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void)vertex_array_object;
|
(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_program; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program);
|
||||||
GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture);
|
GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture);
|
||||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
#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
|
#endif
|
||||||
GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer);
|
GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer);
|
||||||
#ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
#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);
|
if (last_program == 0 || glIsProgram(last_program)) glUseProgram(last_program);
|
||||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||||
if (bd->GlVersion >= 330)
|
if (bd->GlVersion >= 330 || bd->GlProfileIsES3)
|
||||||
glBindSampler(0, last_sampler);
|
glBindSampler(0, last_sampler);
|
||||||
#endif
|
#endif
|
||||||
glActiveTexture(last_active_texture);
|
glActiveTexture(last_active_texture);
|
||||||
|
@ -66,6 +66,7 @@ Other changes:
|
|||||||
Win32/Winapi with OpenGL. (#3218)
|
Win32/Winapi with OpenGL. (#3218)
|
||||||
- Backends: OpenGL3: Restore front and back polygon mode separately when supported
|
- Backends: OpenGL3: Restore front and back polygon mode separately when supported
|
||||||
by context (Desktop 3.0, 3.1, or 3.2+ with compat bit). (#6333) [@GereonV]
|
by context (Desktop 3.0, 3.1, or 3.2+ with compat bit). (#6333) [@GereonV]
|
||||||
|
- Backends: OpenGL3: Support for glBindSampler() backup/restore on ES3. (#6375) [@jsm174]
|
||||||
- Backends: SDL3: Fixed build on Emscripten/iOS/Android. (#6391) [@jo-codegirl]
|
- Backends: SDL3: Fixed build on Emscripten/iOS/Android. (#6391) [@jo-codegirl]
|
||||||
- Examples: Added native Win32+OpenGL3 example. We don't recommend using this setup but we
|
- Examples: Added native Win32+OpenGL3 example. We don't recommend using this setup but we
|
||||||
provide it for completeness. (#3218, #5170, #6086, #2772, #2600, #2359, #2022, #1553) [@learn-more]
|
provide it for completeness. (#3218, #5170, #6086, #2772, #2600, #2359, #2022, #1553) [@learn-more]
|
||||||
|
Loading…
Reference in New Issue
Block a user