]> git.tdb.fi Git - libs/gl.git/blobdiff - source/vertexarray.cpp
Unbind vertex buffer after updating array data
[libs/gl.git] / source / vertexarray.cpp
index 0d4fd919cffa8daa210c416414024357a07d9d59..81a2acd5182a413777c39f0ebe944fe617b79b22 100644 (file)
@@ -118,7 +118,8 @@ void VertexArray::apply() const
        set_array(GL_TEXTURE_COORD_ARRAY, found&4, 4);
        set_array(GL_COLOR_ARRAY, found&8, 8);
 
-       VertexBuffer::unbind();
+       if(vbuf)
+               VertexBuffer::unbind();
 }
 
 /**
@@ -127,7 +128,10 @@ Updates the VertexArray data to the VertexBuffer tied to the array, if any.
 void VertexArray::update_data()
 {
        if(vbuf)
+       {
                vbuf->data(data.size()*sizeof(float), &data[0]);
+               VertexBuffer::unbind();
+       }
 }
 
 void VertexArray::set_array(unsigned array, unsigned bit, unsigned mask) const