aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java1
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java11
3 files changed, 20 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
index 140c8691f..dc87c7ac9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
@@ -264,6 +264,7 @@ public class GLReadBufferUtil {
readPixelBuffer = null;
}
readPixelSizeLast = 0;
+ pixelBufferProvider.dispose();
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
index 66fba98fe..2f0c86255 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
@@ -105,6 +105,9 @@ public class TextureData {
* </p>
*/
Buffer allocate(int width, int height, int minByteSize);
+
+ /** Dispose resources. */
+ void dispose();
}
/**
* Default {@link PixelBufferProvider} utilizing best match for {@link PixelAttributes}
@@ -139,6 +142,11 @@ public class TextureData {
public final Buffer allocate(int width, int height, int minByteSize) {
return Buffers.newDirectByteBuffer(minByteSize);
}
+
+ @Override
+ public void dispose() {
+ // nop
+ }
}
protected int width;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
index d77bd835e..7a0f00edf 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
@@ -104,11 +104,22 @@ public class AWTTextureData extends TextureData {
return IntBuffer.wrap( readBackIntBuffer );
}
+ @Override
+ public void dispose() {
+ if(null != image) {
+ image.flush();
+ image = null;
+ }
+ }
+
/** Returns the number source components being used as indicated at {@link #allocate(int, int, int)}. */
public int getComponentCount() { return componentCount; }
/** Returns the underlying {@link BufferedImage} as allocated via {@link #allocate(int, int, int)}. */
public BufferedImage getImage() { return image; }
+
+ /** Returns true if an underlying {@link BufferedImage} has been allocated via {@link #allocate(int, int, int)}. */
+ public boolean hasImage() { return null != image; }
}
// Mechanism for lazily converting input BufferedImages with custom