This commit is contained in:
Mikulas Florek 2018-10-20 02:12:07 +02:00
parent 6580cb6204
commit dea0e42f10
2 changed files with 8 additions and 4 deletions

View file

@ -28,6 +28,8 @@ attribute { name = "a_uv", semantic = SEMANTICS_TEXCOORD0 }
attribute { name = "a_normal", semantic = SEMANTICS_NORMAL }
attribute { name = "a_indices", semantic = SEMANTICS_INDICES }
attribute { name = "a_weights", semantic = SEMANTICS_WEIGHTS }
attribute { name = "i_rot_quat", semantic = SEMANTICS_INSTANCE0 }
attribute { name = "i_pos_scale", semantic = SEMANTICS_INSTANCE1 }
include "pipelines/common.glsl"

View file

@ -997,10 +997,12 @@ void setInstanceBuffer(const VertexDecl& decl, BufferHandle instance_buffer, int
}
const int index = attributes_map ? attributes_map[i] : location_offset + i;
CHECK_GL(glBindBuffer(GL_ARRAY_BUFFER, ib));
CHECK_GL(glVertexAttribPointer(index, attr->components_num, gl_attr_type, attr->flags & Attribute::NORMALIZED, stride, offset));
CHECK_GL(glVertexAttribDivisor(index, 1));
CHECK_GL(glEnableVertexAttribArray(index));
if(index >= 0) {
CHECK_GL(glBindBuffer(GL_ARRAY_BUFFER, ib));
CHECK_GL(glVertexAttribPointer(index, attr->components_num, gl_attr_type, attr->flags & Attribute::NORMALIZED, stride, offset));
CHECK_GL(glVertexAttribDivisor(index, 1));
CHECK_GL(glEnableVertexAttribArray(index));
}
}
}