diff options
11 files changed, 40 insertions, 41 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index a37922e3f..dd55588b2 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -1031,6 +1031,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing chooser, Math.max(1, panelWidth), Math.max(1, panelHeight)); + offscreenDrawable.setRealized(true); offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith); offscreenContext.setSynchronized(true); offscreenContext.setContextCreationFlags(additionalCtxCreationFlags); diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index a40b112b1..e5f415a87 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -134,29 +134,26 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { GLDrawable result = null; adevice.lock(); try { - if(chosenCaps.isOnscreen()) { + final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(target, true); + if(null != ols) { + // layered surface -> Offscreen/PBuffer + final GLCapabilities chosenCapsMod = (GLCapabilities) chosenCaps.cloneMutable(); + chosenCapsMod.setOnscreen(false); + chosenCapsMod.setPBuffer(canCreateGLPbuffer(adevice)); + config.setChosenCapabilities(chosenCapsMod); + if(DEBUG) { + System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable -> Offscreen-Layer: "+target); + } + if( ! ( target instanceof SurfaceChangeable ) ) { + throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen layered surface: "+target); + } + result = createOffscreenDrawableImpl(target); + } else if(chosenCaps.isOnscreen()) { // onscreen - final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(target, true); - if(null == ols) { - // traditional onscreen - if(DEBUG) { - System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable: "+target); - } - result = createOnscreenDrawableImpl(target); - } else { - // layered surface -> offscreen/PBuffer - final GLCapabilities chosenCapsMod = (GLCapabilities) chosenCaps.cloneMutable(); - chosenCapsMod.setOnscreen(false); - chosenCapsMod.setPBuffer(canCreateGLPbuffer(adevice)); - config.setChosenCapabilities(chosenCapsMod); - if(DEBUG) { - System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable -> Offscreen-Layer: "+target); - } - if( ! ( target instanceof SurfaceChangeable ) ) { - throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen layered surface: "+target); - } - result = createOffscreenDrawableImpl(target); + if(DEBUG) { + System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable: "+target); } + result = createOnscreenDrawableImpl(target); } else { // offscreen if(DEBUG) { @@ -215,6 +212,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { device.lock(); try { drawable = (GLDrawableImpl) createGLDrawable( createOffscreenSurfaceImpl(device, capsChosen, capsRequested, chooser, width, height) ); + if(null != drawable) { + drawable.setRealized(true); + } } finally { device.unlock(); } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 71eec2fbd..1453a853c 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -40,8 +40,16 @@ package jogamp.opengl; -import java.util.*; -import javax.media.opengl.*; +import java.util.ArrayList; +import java.util.HashSet; + +import javax.media.opengl.GLAnimatorControl; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLContext; +import javax.media.opengl.GLDrawable; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLException; +import javax.media.opengl.GLRunnable; import com.jogamp.opengl.util.Animator; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java index 643583fe5..28a23d294 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java @@ -53,7 +53,6 @@ public class EGLPbufferDrawable extends EGLDrawable { protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeSurface target) { super(factory, target); - setRealized(true); } protected void destroyImpl() { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index ed53a9ee5..1e55879f7 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -215,6 +215,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { caps.setPBuffer(true); final MacOSXCGLDrawable drawable = (MacOSXCGLDrawable) createGLDrawable( createOffscreenSurfaceImpl(sharedDevice, caps, caps, null, 64, 64) ); if(null!=drawable) { + drawable.setRealized(true); final GLContext context = drawable.createContext(null); if (null != context) { context.setSynchronized(true); @@ -302,7 +303,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { if(!caps.isPBuffer()) { return new MacOSXOffscreenCGLDrawable(this, target); } - return new MacOSXPbufferCGLDrawable(this, target, true); + return new MacOSXPbufferCGLDrawable(this, target); } public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index ae3fa1428..f81cd725e 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -48,7 +48,7 @@ public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { public MacOSXOffscreenCGLDrawable(GLDrawableFactory factory, NativeSurface target) { - super(factory, target, true); + super(factory, target); } public GLContext createContext(GLContext shareWith) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 5463c67bf..e02c3efec 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -74,12 +74,8 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { protected long pBuffer; protected int pBufferTexTarget, pBufferTexWidth, pBufferTexHeight; - public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target, boolean realizeNow) { + public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, false); - - if(realizeNow) { - setRealized(true); - } } protected void destroyImpl() { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java index 9e3f71513..574226570 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java @@ -58,7 +58,6 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { protected WindowsBitmapWGLDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, false); - setRealized(true); } protected void destroyImpl() { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index c7becfdaf..740fb5466 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -64,8 +64,6 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { protected WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, false); - - setRealized(true); } protected void destroyImpl() { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index 1bbeece6d..da7b535cb 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -49,12 +49,6 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { GLCapabilitiesChooser chooser, int width, int height */ super(factory, target, false); - - setRealized(true); - - if (DEBUG) { - System.err.println("Created pbuffer " + this); - } } protected void destroyImpl() { @@ -133,6 +127,10 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { GLX.glXQueryDrawable(display, pbuffer, GLX.GLX_HEIGHT, tmp, 0); int height = tmp[0]; ((SurfaceChangeable)ns).surfaceSizeChanged(width, height); + + if (DEBUG) { + System.err.println("Created pbuffer " + this); + } } public int getFloatingPointMode() { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java index 82ad31aad..7dae20f80 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java @@ -49,7 +49,6 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { protected X11PixmapGLXDrawable(GLDrawableFactory factory, NativeSurface target) { super(factory, target, false); - setRealized(true); } protected void destroyImpl() { |