free frame buffer

This commit is contained in:
2025-05-18 11:37:57 +02:00
parent 56f2aa3c56
commit fefb826b38
2 changed files with 12 additions and 1 deletions

View File

@@ -72,5 +72,6 @@ public class Renderer implements Closeable {
public void close() throws IOException { public void close() throws IOException {
this.boardShader.close(); this.boardShader.close();
this.pieceShader.close(); this.pieceShader.close();
this.frameBuffer.close();
} }
} }

View File

@@ -11,9 +11,12 @@ import static org.lwjgl.opengl.GL11.glClear;
import static org.lwjgl.opengl.GL11.glTexImage2D; import static org.lwjgl.opengl.GL11.glTexImage2D;
import static org.lwjgl.opengl.GL11.glViewport; import static org.lwjgl.opengl.GL11.glViewport;
import java.io.Closeable;
import java.io.IOException;
import org.lwjgl.opengl.GL30; import org.lwjgl.opengl.GL30;
public class FrameBuffer { public class FrameBuffer implements Closeable {
private int fbo; private int fbo;
private int renderTexture; private int renderTexture;
@@ -103,4 +106,11 @@ public class FrameBuffer {
return renderTexture; return renderTexture;
} }
@Override
public void close() throws IOException {
GL30.glDeleteFramebuffers(this.fbo);
GL30.glDeleteRenderbuffers(this.depthBuffer);
GL30.glDeleteTextures(this.renderTexture);
}
} }