summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-11-08 13:05:14 -0800
committerChris Loer <chris.loer@gmail.com>2017-11-08 13:05:14 -0800
commita2bcef5d1cf9a8acc4a4772329c6dc80c9b1e077 (patch)
tree4e04288f53f4c88ebff3df9736a6d5089f0645f1
parent0f4eed2959f7741ccf73dd79297b5fe17ff23829 (diff)
downloadqtlocation-mapboxgl-a2bcef5d1cf9a8acc4a4772329c6dc80c9b1e077.tar.gz
Unbind VAO before binding a GL_ELEMENT_ARRAY_BUFFER.
Fixes the native equivalent of gl-js issue #5620.
-rw-r--r--src/mbgl/gl/context.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index b4be982be4..69b54c6e71 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -237,6 +237,9 @@ UniqueBuffer Context::createIndexBuffer(const void* data, std::size_t size, cons
}
void Context::updateIndexBuffer(UniqueBuffer& buffer, const void* data, std::size_t size) {
+ // Be sure to unbind any existing vertex array object before binding the index buffer
+ // so that we don't mess up another VAO
+ bindVertexArray = 0;
globalVertexArrayState.indexBuffer = buffer;
MBGL_CHECK_ERROR(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, size, data));
}