diff --git a/src/org/hl/engine/graphics/Mesh.java b/src/org/hl/engine/graphics/Mesh.java index f59c735..038a855 100644 --- a/src/org/hl/engine/graphics/Mesh.java +++ b/src/org/hl/engine/graphics/Mesh.java @@ -103,13 +103,16 @@ public class Mesh { colorBufferObject = storeData(colorBuffer, 1, 3); + + // Putting texture into the buffer so renderer and shader can read it + FloatBuffer textureBuffer = MemoryUtil.memAllocFloat(vertices.length * 2); float[] textureData = new float[vertices.length * 3]; for (int i = 0; i < vertices.length; i ++ ) { textureData[i * 2] = vertices[i].getTextureCoordinates().getX(); textureData[i * 2 + 1] = vertices[i].getTextureCoordinates().getY(); } - textureBuffer.put(colorData).flip(); + textureBuffer.put(textureData).flip(); textureBufferObject = storeData(textureBuffer, 2, 2);