]> git.tdb.fi Git - libs/gl.git/commitdiff
Some fixes to VAO management
authorMikko Rasa <tdb@tdb.fi>
Tue, 16 Sep 2014 07:31:36 +0000 (10:31 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 16 Sep 2014 07:31:36 +0000 (10:31 +0300)
source/mesh.cpp

index 45c550a0333ed4244de41b976cca39f8f4d905fa..150822ce85e1771a3826332cb19c12922c15a044 100644 (file)
@@ -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);