From 272f13023e24dfd84ebc6f9ba3240bd471537ac0 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 25 Nov 2018 15:26:12 +0100 Subject: [PATCH] glgsg: unbind buffers after draw callback Some libraries (eg. Kivy) leave their buffers bound, so this takes care of that. --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 8e9105de1c..9118366a93 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -10692,6 +10692,20 @@ reissue_transforms() { memset(_vertex_attrib_columns, 0, sizeof(const GeomVertexColumn *) * 32); #endif + // Some libraries (Kivy) leave their buffers bound. How clumsy of them. + if (_supports_buffers) { + _glBindBuffer(GL_ARRAY_BUFFER, 0); + _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + _current_vbuffer_index = 0; + _current_ibuffer_index = 0; + } +#ifndef OPENGLES + if (_supports_glsl) { + _glDisableVertexAttribArray(0); + _glDisableVertexAttribArray(1); + } +#endif + // Since this is called by clear_state_and_transform(), we also should reset // the states that won't automatically be respecified when clearing the // state mask.