#include "vertexarray.h"
#include "vertexsetup.h"
+using namespace std;
+
namespace Msp {
namespace GL {
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);
}
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);
glVertexAttribPointer(t, 4, GL_UNSIGNED_BYTE, true, stride, reinterpret_cast<unsigned char *>(offset));
else
glVertexAttribPointer(t, sz, GL_FLOAT, false, stride, reinterpret_cast<float *>(offset));
- glVertexAttribDivisor(t, divisor);
+ if(ARB_instanced_arrays)
+ glVertexAttribDivisor(t, divisor);
glEnableVertexAttribArray(t);
}
offset += sz*sizeof(float);