From: Mikko Rasa Date: Tue, 16 Sep 2014 07:31:36 +0000 (+0300) Subject: Some fixes to VAO management X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=910b5be9d486e36fbee15fbd89030202949f73b0;p=libs%2Fgl.git Some fixes to VAO management --- 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);