]> git.tdb.fi Git - libs/gl.git/commitdiff
Throw an exception if trying to draw a Mesh with a different Mesh bound
authorMikko Rasa <tdb@tdb.fi>
Sat, 21 Dec 2013 16:57:41 +0000 (18:57 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 21 Dec 2013 16:57:41 +0000 (18:57 +0200)
source/mesh.cpp

index 91dadeab00af09b584aaf1abad7b54333bbc7812..316e5a3aa9f72ecbcfb3d09e5c9bc09e3b79dfe0 100644 (file)
@@ -1,6 +1,7 @@
 #include <msp/gl/extensions/arb_vertex_array_object.h>
 #include <msp/gl/extensions/arb_vertex_shader.h>
 #include "buffer.h"
+#include "error.h"
 #include "mesh.h"
 #include "renderer.h"
 
@@ -152,6 +153,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())