X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmesh.cpp;h=45b022facc1edb8a673c4ea5e6d59485bff2b209;hb=55f24c84b7270e117615b212665f17d64771cede;hp=91dadeab00af09b584aaf1abad7b54333bbc7812;hpb=61ff840cd211f10d45dca8c4dad2cca5f68aaa42;p=libs%2Fgl.git diff --git a/source/mesh.cpp b/source/mesh.cpp index 91dadeab..45b022fa 100644 --- a/source/mesh.cpp +++ b/source/mesh.cpp @@ -1,6 +1,7 @@ #include #include #include "buffer.h" +#include "error.h" #include "mesh.h" #include "renderer.h" @@ -75,6 +76,9 @@ void Mesh::create_buffers() void Mesh::refresh() const { + if(!vbuf) + return; + vertices.refresh(); if(dirty) { @@ -152,6 +156,10 @@ void Mesh::set_winding(const WindingTest *w) void Mesh::draw() const { + const Mesh *cur = current(); + if(cur && cur!=this) + throw invalid_operation("Mesh::draw"); + refresh(); if(!current())