merge-stonecutter #16
No files matched your search
@@ -35,7 +35,10 @@ public abstract class GlObject {
|
||||
return this.handle != INVALID_HANDLE;
|
||||
}
|
||||
|
||||
public final void invalidateHandle() {
|
||||
public final void delete() {
|
||||
this.destroyInternal();
|
||||
this.handle = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
protected abstract void destroyInternal();
|
||||
}
|
||||
@@ -12,4 +12,9 @@ public class GlVertexArray extends GlObject {
|
||||
public GlVertexArray() {
|
||||
this.setHandle(GL30C.glGenVertexArrays());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void destroyInternal() {
|
||||
GL30C.glDeleteVertexArrays(this.handle());
|
||||
}
|
||||
}
|
||||
@@ -17,4 +17,9 @@ public abstract class GlBuffer extends GlObject {
|
||||
public void setActiveMapping(GlBufferMapping mapping) {
|
||||
this.activeMapping = mapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void destroyInternal() {
|
||||
GL20C.glDeleteBuffers(this.handle());
|
||||
}
|
||||
}
|
||||
@@ -135,20 +135,14 @@ public class GLRenderDevice implements RenderDevice {
|
||||
|
||||
this.stateTracker.notifyBufferDeleted(buffer);
|
||||
|
||||
int handle = buffer.handle();
|
||||
buffer.invalidateHandle();
|
||||
|
||||
GL20C.glDeleteBuffers(handle);
|
||||
buffer.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteVertexArray(GlVertexArray vertexArray) {
|
||||
this.stateTracker.notifyVertexArrayDeleted(vertexArray);
|
||||
|
||||
int handle = vertexArray.handle();
|
||||
vertexArray.invalidateHandle();
|
||||
|
||||
GL30C.glDeleteVertexArrays(handle);
|
||||
vertexArray.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,10 +44,9 @@ public class GlProgram<T> extends GlObject implements ShaderBindingContext {
|
||||
GL20C.glUseProgram(0);
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
@Override
|
||||
protected void destroyInternal() {
|
||||
GL20C.glDeleteProgram(this.handle());
|
||||
|
||||
this.invalidateHandle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,9 +43,8 @@ public class GlShader extends GlObject {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
@Override
|
||||
protected void destroyInternal() {
|
||||
GL20C.glDeleteShader(this.handle());
|
||||
|
||||
this.invalidateHandle();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user