aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/lodmod
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2021-05-07 14:34:30 +0200
committermakamys <makamys@outlook.com>2021-05-07 14:34:30 +0200
commit5ee5b7deaccf951c168e202b91a1a2fc8438368f (patch)
tree02250b21c1215ffaebd6b8e31334478f5fdc28c6 /src/main/java/makamys/lodmod
parent77cd6075160cd2d90f1d587fcafcc9f8803185a1 (diff)
downloadNeodymium-5ee5b7deaccf951c168e202b91a1a2fc8438368f.tar.gz
Neodymium-5ee5b7deaccf951c168e202b91a1a2fc8438368f.tar.bz2
Neodymium-5ee5b7deaccf951c168e202b91a1a2fc8438368f.zip
Unload stuff from RAM on world unload
Diffstat (limited to 'src/main/java/makamys/lodmod')
-rw-r--r--src/main/java/makamys/lodmod/renderer/LODRenderer.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
index 2295848..6cea136 100644
--- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java
+++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
@@ -49,7 +49,7 @@ public class LODRenderer {
private static int BUFFER_SIZE = 1024 * 1024 * 1024;
private static int MAX_MESHES = 100000;
- private int VAO, VBO, EBO, shaderProgram;
+ private int VAO, VBO, shaderProgram;
private IntBuffer piFirst, piCount;
List<Chunk> myChunks = new ArrayList<Chunk>();
@@ -120,12 +120,6 @@ public class LODRenderer {
}
}
- public void destroy() {
- /*glDeleteProgram(shaderProgram);
- glDeleteVertexArrays(VAO);
- glDeleteBuffers(VBO);*/
- }
-
private void handleKeyboard() {
if(Keyboard.isKeyDown(Keyboard.KEY_F) && !wasDown[Keyboard.KEY_F]) {
renderLOD = !renderLOD;
@@ -256,9 +250,6 @@ public class LODRenderer {
VBO = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, VBO);
- EBO = glGenBuffers();
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
-
glBufferData(GL_ARRAY_BUFFER, BUFFER_SIZE, GL_STATIC_DRAW);
int stride = 7 * 4;
@@ -284,6 +275,12 @@ public class LODRenderer {
return true;
}
+ public void destroy() {
+ glDeleteProgram(shaderProgram);
+ glDeleteVertexArrays(VAO);
+ glDeleteBuffers(VBO);
+ }
+
public void onWorldRendererPost(WorldRenderer wr) {
LODChunk lodChunk = getLODChunk(Math.floorDiv(wr.posX, 16), Math.floorDiv(wr.posZ, 16));
lodChunk.putChunkMeshes(Math.floorDiv(wr.posY, 16), ((IWorldRenderer)wr).getChunkMeshes());