diff options
Diffstat (limited to 'src/net/java/games/jogl')
14 files changed, 18 insertions, 62 deletions
diff --git a/src/net/java/games/jogl/GLJPanel.java b/src/net/java/games/jogl/GLJPanel.java index 59b2ee86d..e9b58bdae 100644 --- a/src/net/java/games/jogl/GLJPanel.java +++ b/src/net/java/games/jogl/GLJPanel.java @@ -310,6 +310,16 @@ public final class GLJPanel extends JPanel implements GLDrawable { } } + public void setOpaque(boolean opaque) { + if (opaque != isOpaque()) { + if (offscreenImage != null) { + offscreenImage.flush(); + offscreenImage = null; + } + } + super.setOpaque(opaque); + } + public void addGLEventListener(GLEventListener listener) { drawableHelper.addGLEventListener(listener); } @@ -546,15 +556,17 @@ public final class GLJPanel extends JPanel implements GLDrawable { int awtFormat = 0; int hwGLFormat = 0; if (!hardwareAccelerationDisabled) { - // Should be more flexible in these BufferedImage formats; - // perhaps see what the preferred image types are on the - // given platform - awtFormat = BufferedImage.TYPE_INT_RGB; - // This seems to be a good choice on all platforms hwGLFormat = GL.GL_UNSIGNED_INT_8_8_8_8_REV; + } + + // Should be more flexible in these BufferedImage formats; + // perhaps see what the preferred image types are on the + // given platform + if (isOpaque()) { + awtFormat = BufferedImage.TYPE_INT_RGB; } else { - awtFormat = offscreenContext.getOffscreenContextBufferedImageType(); + awtFormat = BufferedImage.TYPE_INT_ARGB; } offscreenImage = new BufferedImage(panelWidth, diff --git a/src/net/java/games/jogl/impl/GLContext.java b/src/net/java/games/jogl/impl/GLContext.java index a70b195ac..41fa98c4b 100644 --- a/src/net/java/games/jogl/impl/GLContext.java +++ b/src/net/java/games/jogl/impl/GLContext.java @@ -593,10 +593,6 @@ public abstract class GLContext { requests. */ protected abstract boolean isOffscreen(); - /** Only called for offscreen contexts; returns the type of - BufferedImage required for reading this context's pixels. */ - public abstract int getOffscreenContextBufferedImageType(); - /** Only called for offscreen contexts; returns the buffer from which to read pixels (GL.GL_FRONT or GL.GL_BACK). */ public abstract int getOffscreenContextReadBuffer(); diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java index 9361ab5c0..29a3ef63b 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java @@ -66,10 +66,6 @@ class MacOSXDummyGLContext extends MacOSXGLContext return false; } - public int getOffscreenContextBufferedImageType() { - throw new GLException("Should not call this"); - } - public int getOffscreenContextReadBuffer() { throw new GLException("Should not call this"); } diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java index 272f72372..ec58de9a6 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java @@ -93,10 +93,6 @@ public abstract class MacOSXGLContext extends GLContext protected abstract boolean isOffscreen(); - public int getOffscreenContextBufferedImageType() { - throw new GLException("Should not call this"); - } - public int getOffscreenContextReadBuffer() { throw new GLException("Should not call this"); } diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java index 1cb3269e2..37b2302c0 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java @@ -59,10 +59,6 @@ public class MacOSXOffscreenGLContext extends MacOSXPbufferGLContext return true; } - public int getOffscreenContextBufferedImageType() { - return BufferedImage.TYPE_INT_ARGB; - } - public int getOffscreenContextWidth() { return initWidth; } diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java index 7b6337c8e..ba4eee0ef 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java @@ -70,10 +70,6 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext { return false; } - public int getOffscreenContextBufferedImageType() { - throw new GLException("Should not call this"); - } - public int getOffscreenContextReadBuffer() { throw new GLException("Should not call this"); } diff --git a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java index f597d56b7..e838c68aa 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java +++ b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java @@ -106,8 +106,6 @@ public abstract class WindowsGLContext extends GLContext { protected abstract boolean isOffscreen(); - public abstract int getOffscreenContextBufferedImageType(); - public int getOffscreenContextWidth() { throw new GLException("Should not call this"); } diff --git a/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java index dbb6fc69c..c70607da7 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java +++ b/src/net/java/games/jogl/impl/windows/WindowsOffscreenGLContext.java @@ -65,14 +65,6 @@ public class WindowsOffscreenGLContext extends WindowsGLContext { return true; } - public int getOffscreenContextBufferedImageType() { - if (capabilities.getAlphaBits() > 0) { - return BufferedImage.TYPE_INT_ARGB; - } else { - return BufferedImage.TYPE_INT_RGB; - } - } - public int getOffscreenContextWidth() { return width; } diff --git a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java index d66412e74..0dc1818fb 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java +++ b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java @@ -89,10 +89,6 @@ public class WindowsOnscreenGLContext extends WindowsGLContext { return false; } - public int getOffscreenContextBufferedImageType() { - throw new GLException("Should not call this"); - } - public int getOffscreenContextReadBuffer() { throw new GLException("Should not call this"); } diff --git a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java index 077a852c9..1d5d78296 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java +++ b/src/net/java/games/jogl/impl/windows/WindowsPbufferGLContext.java @@ -455,10 +455,6 @@ public class WindowsPbufferGLContext extends WindowsGLContext { return false; } - public int getOffscreenContextBufferedImageType() { - throw new GLException("Should not call this"); - } - public int getOffscreenContextReadBuffer() { throw new GLException("Should not call this"); } diff --git a/src/net/java/games/jogl/impl/x11/X11GLContext.java b/src/net/java/games/jogl/impl/x11/X11GLContext.java index 13018764a..53f44101f 100644 --- a/src/net/java/games/jogl/impl/x11/X11GLContext.java +++ b/src/net/java/games/jogl/impl/x11/X11GLContext.java @@ -110,8 +110,6 @@ public abstract class X11GLContext extends GLContext { protected abstract boolean isOffscreen(); - public abstract int getOffscreenContextBufferedImageType(); - public int getOffscreenContextWidth() { throw new GLException("Should not call this"); } diff --git a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java index aeabe8afb..8f0aa06a5 100644 --- a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java +++ b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java @@ -65,14 +65,6 @@ public class X11OffscreenGLContext extends X11GLContext { return true; } - public int getOffscreenContextBufferedImageType() { - if (capabilities.getAlphaBits() > 0) { - return BufferedImage.TYPE_INT_ARGB; - } else { - return BufferedImage.TYPE_INT_RGB; - } - } - public int getOffscreenContextWidth() { return width; } diff --git a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java index c79501017..2fd340d79 100644 --- a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java +++ b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java @@ -70,10 +70,6 @@ public class X11OnscreenGLContext extends X11GLContext { return false; } - public int getOffscreenContextBufferedImageType() { - throw new GLException("Should not call this"); - } - public int getOffscreenContextReadBuffer() { throw new GLException("Should not call this"); } diff --git a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java index a5a1785a2..d9f18a760 100644 --- a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java +++ b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java @@ -286,10 +286,6 @@ public class X11PbufferGLContext extends X11GLContext { return false; } - public int getOffscreenContextBufferedImageType() { - throw new GLException("Should not call this"); - } - public int getOffscreenContextReadBuffer() { throw new GLException("Should not call this"); } |