glBindVertexArray(0);
}
+void VertexSetup::unload()
+{
+ if(ARB_direct_state_access)
+ {
+ glVertexArrayVertexBuffer(id, 0, 0, 0, 0);
+ glVertexArrayVertexBuffer(id, 1, 0, 0, 0);
+ glVertexArrayElementBuffer(id, 0);
+ }
+ else
+ {
+ BindRestore _bind(*this);
+ Buffer::unbind_from(ARRAY_BUFFER);
+
+ unsigned mask = get_attribs(vertex_format)|get_attribs(inst_format);
+ for(unsigned i=0; mask; ++i, mask>>=1)
+ if(mask&1)
+ {
+ glDisableVertexAttribArray(i);
+ glVertexAttribPointer(i, 1, GL_FLOAT, false, 0, 0);
+ }
+ glBindBuffer(ELEMENT_ARRAY_BUFFER, 0);
+ }
+
+ vertex_array = 0;
+ vertex_format = VertexFormat();
+ inst_array = 0;
+ inst_format = VertexFormat();
+ index_buffer = 0;
+}
+
void VertexSetup::set_debug_name(const string &name)
{
#ifdef DEBUG