free opengl resources
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package chess.view.DDDrender.opengl;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
public class ElementBuffer {
|
||||
private int id;
|
||||
private int indiciesCount;
|
||||
public class ElementBuffer implements Closeable {
|
||||
private final int id;
|
||||
private final int indiciesCount;
|
||||
|
||||
public ElementBuffer(int[] indicies) {
|
||||
this.indiciesCount = indicies.length;
|
||||
@@ -15,10 +18,6 @@ public class ElementBuffer {
|
||||
Unbind();
|
||||
}
|
||||
|
||||
public void Destroy() {
|
||||
GL30.glDeleteBuffers(this.id);
|
||||
}
|
||||
|
||||
public void Bind() {
|
||||
GL30.glBindBuffer(GL30.GL_ELEMENT_ARRAY_BUFFER, this.id);
|
||||
}
|
||||
@@ -30,4 +29,9 @@ public class ElementBuffer {
|
||||
public int GetIndiciesCount() {
|
||||
return this.indiciesCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
GL30.glDeleteBuffers(this.id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user