From 83a5723420a24112dbd77a02135e710d6b37de2f Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Sat, 31 Dec 2022 14:34:59 -0800 Subject: [PATCH] Fix IndexedModel allocating incorrect amount of bytes - model.size() returned the byte size relative to the model's VertexType, but the byte size relative to the passed VertexType is needed instead --- .../java/com/jozufozu/flywheel/backend/model/IndexedModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jozufozu/flywheel/backend/model/IndexedModel.java b/src/main/java/com/jozufozu/flywheel/backend/model/IndexedModel.java index 580ded8b5..7187bb7c0 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/model/IndexedModel.java +++ b/src/main/java/com/jozufozu/flywheel/backend/model/IndexedModel.java @@ -40,7 +40,7 @@ public class IndexedModel implements BufferedModel { vbo.bind(); // allocate the buffer on the gpu - vbo.ensureCapacity(model.size()); + vbo.ensureCapacity(type.byteOffset(model.vertexCount())); // mirror it in system memory, so we can write to it, and upload our model. try (MappedBuffer buffer = vbo.getBuffer()) {