From b03d146efd836248a8fbb40efb3b97d5156caec5 Mon Sep 17 00:00:00 2001 From: 4yn Date: Mon, 8 Jun 2020 16:02:51 +0800 Subject: [PATCH] Fix extra memory allocated when updating color buffer in mesh --- src/rlgl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rlgl.h b/src/rlgl.h index af3dbceda..e6ec4b7c1 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -2587,7 +2587,7 @@ void rlUpdateMeshAt(Mesh mesh, int buffer, int count, int index) case 3: // Update colors (vertex colors) { glBindBuffer(GL_ARRAY_BUFFER, mesh.vboId[3]); - if (index == 0 && count >= mesh.vertexCount) glBufferData(GL_ARRAY_BUFFER, count*4*sizeof(float), mesh.colors, GL_DYNAMIC_DRAW); + if (index == 0 && count >= mesh.vertexCount) glBufferData(GL_ARRAY_BUFFER, count*4*sizeof(unsigned char), mesh.colors, GL_DYNAMIC_DRAW); else if (index + count >= mesh.vertexCount) break; else glBufferSubData(GL_ARRAY_BUFFER, index*4*sizeof(unsigned char), count*4*sizeof(unsigned char), mesh.colors);