[OpenGL] Save/restore last GL_DRAW_FRAMEBUFFER if using `gl_bind_framebuffer`

pull/517/head
jackun 3 years ago
parent 714f3853f7
commit e62d6e3337
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -582,6 +582,9 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
return;
// Backup GL state
GLint last_fb = -1;
if (params.gl_bind_framebuffer >= 0 && (g_IsGLES || g_GlVersion >= 300))
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &last_fb);
GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
glActiveTexture(GL_TEXTURE0);
GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
@ -717,6 +720,8 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
if (last_srgb_enabled)
glEnable(GL_FRAMEBUFFER_SRGB);
if (last_fb >= 0)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, last_fb);
}
}} // namespace

Loading…
Cancel
Save