diff --git a/docs/src/progress/currenttarget.md b/docs/src/progress/currenttarget.md index 6f7bd125..1d954b30 100644 --- a/docs/src/progress/currenttarget.md +++ b/docs/src/progress/currenttarget.md @@ -17,7 +17,6 @@ + feedback driven requirements Much much much much more UI sound effects - Combine inventory menus into one ui UI spacing and scaling Come up with a title for the game and create a title menu for it (ideally with some animation and music) Better skybox diff --git a/src/main/java/electrosphere/renderer/RenderUtils.java b/src/main/java/electrosphere/renderer/RenderUtils.java index c33074bd..213c9818 100644 --- a/src/main/java/electrosphere/renderer/RenderUtils.java +++ b/src/main/java/electrosphere/renderer/RenderUtils.java @@ -355,16 +355,31 @@ public class RenderUtils { int numPoints = data.npoints(); //verts - FloatBuffer verts = data.points(numPoints * 3); - sphereMesh.bufferVertices(verts, 3); + { + FloatBuffer verts = data.points(numPoints * 3); + FloatBuffer vertsFinal = BufferUtils.createFloatBuffer(verts.limit()); //reallocating to BufferUtils buffer to help minimize memory errors + vertsFinal.put(verts); + vertsFinal.flip(); + sphereMesh.bufferVertices(vertsFinal, 3); + } //indices - IntBuffer indices = data.triangles(data.ntriangles() * 3); - sphereMesh.bufferFaces(indices, data.ntriangles() * 3); + { + IntBuffer indices = data.triangles(data.ntriangles() * 3); + IntBuffer indicesFinal = BufferUtils.createIntBuffer(indices.limit()); //reallocating to BufferUtils buffer to help minimize memory errors + indicesFinal.put(indices); + indicesFinal.flip(); + sphereMesh.bufferFaces(indicesFinal, data.ntriangles() * 3); + } //texture coords - FloatBuffer texCoords = data.tcoords(numPoints * 3); - sphereMesh.bufferTextureCoords(texCoords, 2); + { + FloatBuffer texCoords = data.tcoords(numPoints * 3); + FloatBuffer texCoordsFinal = BufferUtils.createFloatBuffer(texCoords.limit()); //reallocating to BufferUtils buffer to help minimize memory errors + texCoordsFinal.put(texCoords); + texCoordsFinal.flip(); + sphereMesh.bufferTextureCoords(texCoordsFinal, 2); + } //setup extra structures @@ -396,16 +411,31 @@ public class RenderUtils { int numPoints = data.npoints(); //verts - FloatBuffer verts = data.points(numPoints * 3); - sphereMesh.bufferVertices(verts, 3); + { + FloatBuffer verts = data.points(numPoints * 3); + FloatBuffer vertsFinal = BufferUtils.createFloatBuffer(verts.limit()); //reallocating to BufferUtils buffer to help minimize memory errors + vertsFinal.put(verts); + vertsFinal.flip(); + sphereMesh.bufferVertices(vertsFinal, 3); + } //indices - IntBuffer indices = data.triangles(data.ntriangles() * 3); - sphereMesh.bufferFaces(indices, data.ntriangles() * 3); - + { + IntBuffer indices = data.triangles(data.ntriangles() * 3); + IntBuffer indicesFinal = BufferUtils.createIntBuffer(indices.limit()); //reallocating to BufferUtils buffer to help minimize memory errors + indicesFinal.put(indices); + indicesFinal.flip(); + sphereMesh.bufferFaces(indicesFinal, data.ntriangles() * 3); + } + //texture coords - FloatBuffer texCoords = data.tcoords(numPoints * 2); - sphereMesh.bufferTextureCoords(texCoords, 2); + { + FloatBuffer texCoords = data.tcoords(numPoints * 3); + FloatBuffer texCoordsFinal = BufferUtils.createFloatBuffer(texCoords.limit()); //reallocating to BufferUtils buffer to help minimize memory errors + texCoordsFinal.put(texCoords); + texCoordsFinal.flip(); + sphereMesh.bufferTextureCoords(texCoordsFinal, 2); + } //setup extra structures Material mat = new Material();