namespace Msp {
namespace GL {
-VertexArray::VertexArray(const VertexFormat &f):
- dirty(false)
+VertexArray::VertexArray(const VertexFormat &f)
{
reset(f);
}
return;
Buffer *vbuf = get_buffer();
- if(vbuf)
- {
- vbuf->bind_to(ARRAY_BUFFER);
- if(dirty)
- update_buffer();
- }
+ Bind _bind_vbuf(vbuf, ARRAY_BUFFER);
+ if(vbuf && dirty)
+ update_buffer();
const float *base = (vbuf ? reinterpret_cast<float *>(get_offset()) : &data[0]);
unsigned stride_bytes = stride*sizeof(float);
apply_arrays(&arrays, (old ? &old->arrays : 0), base, stride_bytes);
-
- if(vbuf)
- Buffer::unbind_from(ARRAY_BUFFER);
}
void VertexArray::apply_arrays(const vector<Array> *arrays, const vector<Array> *old_arrays, const float *base, unsigned stride_bytes)