mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-03 04:53:35 +00:00
Fix mesh mapping;
This commit is contained in:
parent
6c25b9bd4f
commit
5f3ce18fcd
|
@ -281,7 +281,7 @@ void* lovrMeshMap(Mesh* mesh, int start, int count) {
|
||||||
mesh->isMapped = 1;
|
mesh->isMapped = 1;
|
||||||
mesh->mapStart = start;
|
mesh->mapStart = start;
|
||||||
mesh->mapCount = count;
|
mesh->mapCount = count;
|
||||||
GLbitfield access = GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT;
|
GLbitfield access = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo);
|
||||||
return glMapBufferRange(GL_ARRAY_BUFFER, start * mesh->stride, count * mesh->stride, access);
|
return glMapBufferRange(GL_ARRAY_BUFFER, start * mesh->stride, count * mesh->stride, access);
|
||||||
}
|
}
|
||||||
|
@ -299,6 +299,7 @@ void lovrMeshUnmap(Mesh* mesh) {
|
||||||
|
|
||||||
if (mesh->isMapped) {
|
if (mesh->isMapped) {
|
||||||
mesh->isMapped = 0;
|
mesh->isMapped = 0;
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo);
|
||||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue