mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-04 13:33:34 +00:00
Fix mesh index buffer binding;
This commit is contained in:
parent
3143c87197
commit
1d82277173
|
@ -129,7 +129,6 @@ void lovrMeshDraw(Mesh* mesh, mat4 transform) {
|
||||||
size_t start = mesh->rangeStart;
|
size_t start = mesh->rangeStart;
|
||||||
size_t count = mesh->rangeCount;
|
size_t count = mesh->rangeCount;
|
||||||
if (mesh->map.length > 0) {
|
if (mesh->map.length > 0) {
|
||||||
lovrGraphicsBindIndexBuffer(mesh->ibo);
|
|
||||||
glDrawElements(mesh->drawMode, mesh->map.length, GL_UNSIGNED_INT, (GLvoid*) start);
|
glDrawElements(mesh->drawMode, mesh->map.length, GL_UNSIGNED_INT, (GLvoid*) start);
|
||||||
} else {
|
} else {
|
||||||
glDrawArrays(mesh->drawMode, start, count);
|
glDrawArrays(mesh->drawMode, start, count);
|
||||||
|
@ -169,6 +168,7 @@ void lovrMeshSetVertexMap(Mesh* mesh, unsigned int* map, size_t count) {
|
||||||
} else {
|
} else {
|
||||||
vec_clear(&mesh->map);
|
vec_clear(&mesh->map);
|
||||||
vec_pusharr(&mesh->map, map, count);
|
vec_pusharr(&mesh->map, map, count);
|
||||||
|
lovrGraphicsBindVertexArray(mesh->vao);
|
||||||
lovrGraphicsBindIndexBuffer(mesh->ibo);
|
lovrGraphicsBindIndexBuffer(mesh->ibo);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * sizeof(unsigned int), mesh->map.data, GL_STATIC_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * sizeof(unsigned int), mesh->map.data, GL_STATIC_DRAW);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue