summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-05-08 03:49:55 +0200
committerSven Gothel <[email protected]>2013-05-08 03:49:55 +0200
commitff08ebae2f6ed8788d481f4a21fc7a07a75733ee (patch)
tree9afe3ea4c5fc4df2e5dd3b91c6de17fb4fc2800b /src/jogl/classes/com/jogamp/opengl
parentda8717097df2afba3fc7e9ef648ce6bc4ebd4f9f (diff)
GLJPanel: Use PixelBufferProvider AWTPixelBufferProviderInt; PixelBufferProvider: Add 'dispose()' to interface.
Transition reusing AWT specific PixelBufferProvider to allow a later user provided PixelBufferProvider.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-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