X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvertexsetup.cpp;h=7cfc1b6d99499c34ba3831f63495cc109921dba5;hb=fd18332856ddd03f79a54dd034d53cb0a384335d;hp=53f825697b34b16444e783cfb32262361d10fc4f;hpb=67f22642d636861f90a016077c9387b7b8397414;p=libs%2Fgl.git diff --git a/source/vertexsetup.cpp b/source/vertexsetup.cpp index 53f82569..7cfc1b6d 100644 --- a/source/vertexsetup.cpp +++ b/source/vertexsetup.cpp @@ -11,6 +11,8 @@ #include "vertexarray.h" #include "vertexsetup.h" +using namespace std; + namespace Msp { namespace GL { @@ -36,6 +38,9 @@ VertexSetup::~VertexSetup() void VertexSetup::set_vertex_array(const VertexArray &a) { + if(!a.get_buffer()) + throw invalid_argument("VertexSetup::set_vertex_array"); + vertex_array = &a; update(VERTEX_ARRAY); } @@ -43,7 +48,12 @@ void VertexSetup::set_vertex_array(const VertexArray &a) void VertexSetup::set_instance_array(const VertexArray *a) { if(a) + { + if(!a->get_buffer()) + throw invalid_argument("VertexSetup::set_instance_array"); + static Require req(ARB_instanced_arrays); + } inst_array = a; update(INSTANCE_ARRAY); @@ -130,6 +140,9 @@ void VertexSetup::bind() const if(set_current(this)) { + vertex_array->refresh(); + if(inst_array) + inst_array->refresh(); glBindVertexArray(id); if(dirty) {