From 910b5be9d486e36fbee15fbd89030202949f73b0 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 16 Sep 2014 10:31:36 +0300 Subject: [PATCH] Some fixes to VAO management --- source/mesh.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/mesh.cpp b/source/mesh.cpp index 45c550a0..150822ce 100644 --- a/source/mesh.cpp +++ b/source/mesh.cpp @@ -16,7 +16,7 @@ Mesh::Mesh(): ibuf(0), vao_id(0), defer_buffers(true), - dirty(false), + dirty(true), winding(0) { } @@ -114,7 +114,6 @@ void Mesh::add_batch(const Batch &b) if(defer_buffers) create_buffers(); - dirty |= 1; if(!batches.empty() && batches.back().can_append(b.get_type())) batches.back().append(b); else @@ -161,7 +160,10 @@ void Mesh::bind() const /* If VAOs are not supported, vao_id is zero and set_current won't get called. Thus unbind won't try to call a null function either. */ if(!vao_id) + { unbind(); + vertices.apply(); + } else if(set_current(this)) { glBindVertexArray(vao_id); -- 2.43.0