From 2f2f2454e6c8fd3714a61f5250736987a73df655 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Wed, 24 Apr 2013 16:02:04 -0400 Subject: [PATCH] renamed release() as dispose() in all GL classes for consistency with PGraphics.dispose() --- core/src/processing/opengl/FontTexture.java | 7 +++++++ core/src/processing/opengl/FrameBuffer.java | 4 ++-- .../src/processing/opengl/PGraphicsOpenGL.java | 18 +++++++++--------- core/src/processing/opengl/PShader.java | 2 +- core/src/processing/opengl/PShapeOpenGL.java | 2 +- core/src/processing/opengl/Texture.java | 8 ++++---- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/core/src/processing/opengl/FontTexture.java b/core/src/processing/opengl/FontTexture.java index 1421bb4e3..c14367e15 100644 --- a/core/src/processing/opengl/FontTexture.java +++ b/core/src/processing/opengl/FontTexture.java @@ -77,6 +77,13 @@ class FontTexture implements PConstants { } + protected void dispose() { + for (int i = 0; i < textures.length; i++) { + textures[i].dispose(); + } + } + + protected void initTexture(PGraphicsOpenGL pg, PFont font, int w, int h) { maxTexWidth = w; maxTexHeight = h; diff --git a/core/src/processing/opengl/FrameBuffer.java b/core/src/processing/opengl/FrameBuffer.java index 2b899a12b..9c192386f 100644 --- a/core/src/processing/opengl/FrameBuffer.java +++ b/core/src/processing/opengl/FrameBuffer.java @@ -338,7 +338,7 @@ public class FrameBuffer implements PConstants { protected void allocate() { - release(); // Just in the case this object is being re-allocated. + dispose(); // Just in the case this object is being re-allocated. context = pgl.getCurrentContext(); @@ -367,7 +367,7 @@ public class FrameBuffer implements PConstants { } - protected void release() { + protected void dispose() { if (screenFb) return; if (glFbo != 0) { diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index d2b8cc451..18c8b12b0 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -651,10 +651,10 @@ public class PGraphicsOpenGL extends PGraphics { deleteDefaultShaders(); } else { if (offscreenFramebuffer != null) { - offscreenFramebuffer.release(); + offscreenFramebuffer.dispose(); } if (multisampleFramebuffer != null) { - multisampleFramebuffer.release(); + multisampleFramebuffer.dispose(); } } @@ -676,11 +676,11 @@ public class PGraphicsOpenGL extends PGraphics { deleteSurfaceTextures(); if (!primarySurface) { if (offscreenFramebuffer != null) { - offscreenFramebuffer.release(); + offscreenFramebuffer.dispose(); offscreenFramebuffer = null; } if (multisampleFramebuffer != null) { - multisampleFramebuffer.release(); + multisampleFramebuffer.dispose(); multisampleFramebuffer = null; } } @@ -5791,15 +5791,15 @@ public class PGraphicsOpenGL extends PGraphics { protected void deleteSurfaceTextures() { if (texture != null) { - texture.release(); + texture.dispose(); } if (ptexture != null) { - ptexture.release(); + ptexture.dispose(); } if (filterTexture != null) { - filterTexture.release(); + filterTexture.dispose(); } } @@ -5890,10 +5890,10 @@ public class PGraphicsOpenGL extends PGraphics { // is changed), we make sure that all the OpenGL resources associated // to the surface are released by calling delete(). if (offscreenFramebuffer != null) { - offscreenFramebuffer.release(); + offscreenFramebuffer.dispose(); } if (multisampleFramebuffer != null) { - multisampleFramebuffer.release(); + multisampleFramebuffer.dispose(); } boolean packed = depthBits == 24 && stencilBits == 8 && diff --git a/core/src/processing/opengl/PShader.java b/core/src/processing/opengl/PShader.java index ff460079c..10306e53f 100644 --- a/core/src/processing/opengl/PShader.java +++ b/core/src/processing/opengl/PShader.java @@ -882,7 +882,7 @@ public class PShader { protected void loadUniforms() { } - protected void release() { + protected void dispose() { if (glVertex != 0) { PGraphicsOpenGL.deleteGLSLVertShaderObject(glVertex, context); glVertex = 0; diff --git a/core/src/processing/opengl/PShapeOpenGL.java b/core/src/processing/opengl/PShapeOpenGL.java index fe8f82de0..c792ff185 100644 --- a/core/src/processing/opengl/PShapeOpenGL.java +++ b/core/src/processing/opengl/PShapeOpenGL.java @@ -3436,7 +3436,7 @@ public class PShapeOpenGL extends PShape { // Deletion methods - protected void release() { + protected void dispose() { deletePolyBuffers(); deleteLineBuffers(); deletePointBuffers(); diff --git a/core/src/processing/opengl/Texture.java b/core/src/processing/opengl/Texture.java index ce5ba4618..6a26121ec 100644 --- a/core/src/processing/opengl/Texture.java +++ b/core/src/processing/opengl/Texture.java @@ -239,7 +239,7 @@ public class Texture implements PConstants { public void resize(int wide, int high) { // Marking the texture object as finalized so it is deleted // when creating the new texture. - release(); + dispose(); // Creating new texture with the appropriate size. Texture tex = new Texture(wide, high, getParameters()); @@ -1176,7 +1176,7 @@ public class Texture implements PConstants { * Allocates the opengl texture object. */ protected void allocate() { - release(); // Just in the case this object is being re-allocated. + dispose(); // Just in the case this object is being re-allocated. boolean enabledTex = false; if (!pgl.texturingIsEnabled(glTarget)) { @@ -1218,7 +1218,7 @@ public class Texture implements PConstants { /** * Marks the texture object for deletion. */ - protected void release() { + protected void dispose() { if (glName != 0) { PGraphicsOpenGL.finalizeTextureObject(glName, context); glName = 0; @@ -1332,7 +1332,7 @@ public class Texture implements PConstants { protected void copyObject(Texture src) { // The OpenGL texture of this object is replaced with the one from the // source object, so we delete the former to avoid resource wasting. - release(); + dispose(); width = src.width; height = src.height;