From e74f889bc59b7d527b338c04169595cbd16dc3c2 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Fri, 16 May 2014 21:37:28 +0200 Subject: [PATCH] Quad: Don't discard VBO on each update This never yielded any traceable performance gains. I also apparently forgot to unbind the buffer after updating. --- src/quad.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/quad.h b/src/quad.h index 188a829..9f64f21 100644 --- a/src/quad.h +++ b/src/quad.h @@ -112,6 +112,8 @@ struct Quad VBO::bind(vbo); shState->bindQuadIBO(); + VBO::allocEmpty(sizeof(Vertex[4]), GL_DYNAMIC_DRAW); + glEnableVertexAttribArray(Shader::Color); glEnableVertexAttribArray(Shader::Position); glEnableVertexAttribArray(Shader::TexCoord); @@ -136,8 +138,8 @@ struct Quad void updateBuffer() { VBO::bind(vbo); - VBO::allocEmpty(sizeof(Vertex) * 4, GL_DYNAMIC_DRAW); - VBO::uploadData(sizeof(Vertex) * 4, vert, GL_DYNAMIC_DRAW); + VBO::uploadSubData(0, sizeof(Vertex[4]), vert); + VBO::unbind(); } void setPosRect(const FloatRect &r)