X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fvertexarray.cpp;h=e8fa36a030bf5991a89bf4ed8f79944543ced413;hb=f33a98b1a044c8ac7b12778cbca6c4a124875e4a;hp=e453a3f12a569a70f7868288647dee37c6f45b33;hpb=cfd7b5bc0c69d0b8cc7c8b3ec81a1a9462d04abb;p=libs%2Fgl.git diff --git a/source/vertexarray.cpp b/source/vertexarray.cpp index e453a3f1..e8fa36a0 100644 --- a/source/vertexarray.cpp +++ b/source/vertexarray.cpp @@ -3,6 +3,7 @@ #include "buffer.h" #include "error.h" #include "gl.h" +#include "mesh.h" #include "vertexarray.h" using namespace std; @@ -10,8 +11,7 @@ using namespace std; namespace Msp { namespace GL { -VertexArray::VertexArray(const VertexFormat &f): - dirty(false) +VertexArray::VertexArray(const VertexFormat &f) { reset(f); } @@ -112,6 +112,9 @@ void VertexArray::apply() const { if(format.empty()) throw invalid_operation("VertexArray::apply"); + // Don't mess up the vertex array object of a mesh + if(Mesh::current()) + throw invalid_operation("VertexArray::apply"); const VertexArray *old = current(); /* If the array has been modified, apply it even if it was the last one to