aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/javax/media/opengl/util/FBObject.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/javax/media/opengl/util/FBObject.java')
-rwxr-xr-xsrc/classes/javax/media/opengl/util/FBObject.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/classes/javax/media/opengl/util/FBObject.java b/src/classes/javax/media/opengl/util/FBObject.java
index 660c8c806..340655966 100755
--- a/src/classes/javax/media/opengl/util/FBObject.java
+++ b/src/classes/javax/media/opengl/util/FBObject.java
@@ -207,6 +207,33 @@ public class FBObject {
unbind(gl);
}
+ public void destroy(GL gl) {
+ unbind(gl);
+
+ int name[] = new int[1];
+
+ if(0!=stencil_rb) {
+ name[0] = stencil_rb;
+ gl.glDeleteRenderbuffers(1, name, 0);
+ stencil_rb = 0;
+ }
+ if(0!=depth_rb) {
+ name[0] = depth_rb;
+ gl.glDeleteRenderbuffers(1, name, 0);
+ depth_rb=0;
+ }
+ if(0!=fbo_tex) {
+ name[0] = fbo_tex;
+ gl.glDeleteTextures(1, name, 0);
+ fbo_tex = 0;
+ }
+ if(0!=fb) {
+ name[0] = fb;
+ gl.glDeleteFramebuffers(1, name, 0);
+ fb = 0;
+ }
+ }
+
public void bind(GL gl) {
gl.glBindTexture(GL.GL_TEXTURE_2D, fbo_tex);
gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, fb);