free opengl resources
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package chess.view.DDDrender.world;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import chess.model.Coordinate;
|
||||
@@ -38,4 +40,9 @@ public class BoardEntity extends Entity {
|
||||
renderer.RenderVao(renderer.getBoardShader(), vao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
vao.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package chess.view.DDDrender.world;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
import chess.view.DDDrender.Renderer;
|
||||
|
||||
public abstract class Entity {
|
||||
public abstract class Entity implements Closeable{
|
||||
|
||||
public abstract void render(Renderer renderer);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package chess.view.DDDrender.world;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import chess.view.DDDrender.DDDModel;
|
||||
@@ -36,4 +38,9 @@ public class ModelEntity extends Entity {
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
this.model.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package chess.view.DDDrender.world;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,7 +9,7 @@ import chess.model.Coordinate;
|
||||
import chess.model.Move;
|
||||
import chess.model.Piece;
|
||||
|
||||
public class World {
|
||||
public class World implements Closeable{
|
||||
/** Renderable entity list */
|
||||
private final List<Entity> entites;
|
||||
|
||||
@@ -55,4 +57,11 @@ public class World {
|
||||
return entites;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
for (Entity entity : entites) {
|
||||
entity.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user