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