From 77bec45b4a60e6da4476c9ca1b1632b14910fef9 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 31 Aug 2014 01:15:58 -0300 Subject: [PATCH] Fixed SpriteBatch:setBufferSize. --- src/modules/graphics/opengl/SpriteBatch.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/SpriteBatch.cpp b/src/modules/graphics/opengl/SpriteBatch.cpp index 363b91fa3..08fcf7e04 100644 --- a/src/modules/graphics/opengl/SpriteBatch.cpp +++ b/src/modules/graphics/opengl/SpriteBatch.cpp @@ -233,7 +233,10 @@ void SpriteBatch::setBufferSize(int newsize) } // Copy as much of the old data into the new VertexBuffer as can fit. - new_array_buf->fill(0, sizeof(Vertex) * 4 * std::min(newsize, size), old_data); + { + VertexBuffer::Bind bind(*new_array_buf); + new_array_buf->fill(0, sizeof(Vertex) * 4 * std::min(newsize, size), old_data); + } // We don't need to unmap the old VertexBuffer since we're deleting it. delete array_buf;