X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Finstancearray.cpp;h=293fa6cdad8e1ee55384df261a50f22b58997a25;hb=bea2bcf1aa353b1dd8d1728931ef0508677bd2c6;hp=039a50ecde32a7500850ca107f040169fe0b5692;hpb=73567be7cd9e01e620cb2a8fa0ca381723b9a71f;p=libs%2Fgl.git diff --git a/source/render/instancearray.cpp b/source/render/instancearray.cpp index 039a50ec..293fa6cd 100644 --- a/source/render/instancearray.cpp +++ b/source/render/instancearray.cpp @@ -46,7 +46,7 @@ InstanceArray::InstanceArray(const Object &o): { instance_data = new VertexArray((RAW_ATTRIB4,matrix_location, RAW_ATTRIB4,matrix_location+1, RAW_ATTRIB4,matrix_location+2)); const VertexFormat &fmt = instance_data->get_format(); - matrix_offset = fmt.offset(make_indexed_attribute(RAW_ATTRIB4, matrix_location)); + matrix_offset = fmt.offset((RAW_ATTRIB4,matrix_location)); instance_buffer = new Buffer; instance_data->use_buffer(instance_buffer); @@ -110,9 +110,9 @@ void InstanceArray::update_instance_matrix(unsigned index) const Matrix &m = *instances[index]->get_matrix(); - float *d = instance_data->modify(instances.size()-1); + float *d = reinterpret_cast(instance_data->modify(instances.size()-1)+matrix_offset); for(unsigned i=0; i<12; ++i) - d[matrix_offset+i] = m(i/4, i%4); + d[i] = m(i/4, i%4); } void InstanceArray::render(Renderer &renderer, Tag tag) const