aboutsummaryrefslogtreecommitdiffstats
path: root/src/sprite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sprite.cpp')
-rw-r--r--src/sprite.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sprite.cpp b/src/sprite.cpp
index 941a680d..010b43a7 100644
--- a/src/sprite.cpp
+++ b/src/sprite.cpp
@@ -62,14 +62,20 @@ void Sprite::draw()
{
glBindTexture(GL_TEXTURE_2D, texture_.id);
glBindBuffer(GL_ARRAY_BUFFER, vbo_id_);
+
glEnableVertexAttribArray(0);
+ glEnableVertexAttribArray(1);
+ glEnableVertexAttribArray(2);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, position));
glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void *)offsetof(Vertex, color));
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, uv));
glDrawArrays(GL_TRIANGLES, 0, 6);
+ glDisableVertexAttribArray(2);
+ glDisableVertexAttribArray(1);
glDisableVertexAttribArray(0);
+
glBindBuffer(GL_ARRAY_BUFFER, 0);
}