diff --git a/src/modules/graphics/opengl/VertexBuffer.cpp b/src/modules/graphics/opengl/VertexBuffer.cpp index a8bc11d08..3a5847604 100644 --- a/src/modules/graphics/opengl/VertexBuffer.cpp +++ b/src/modules/graphics/opengl/VertexBuffer.cpp @@ -165,8 +165,11 @@ void VBO::unmap() // VBO::bind is a no-op when the VBO is mapped, so we have to make sure it's // bound here. - if (is_bound) + if (!is_bound) + { glBindBufferARB(getTarget(), vbo); + is_bound = true; + } // "orphan" current buffer to avoid implicit synchronisation on the gpu: // http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf @@ -179,14 +182,15 @@ void VBO::unmap() void VBO::bind() { if (!is_mapped) + { glBindBufferARB(getTarget(), vbo); - - is_bound = true; + is_bound = true; + } } void VBO::unbind() { - if (!is_mapped) + if (is_bound) glBindBufferARB(getTarget(), 0); is_bound = false;