diff options
author | Sven Gothel <[email protected]> | 2009-10-03 21:56:30 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-03 21:56:30 -0700 |
commit | bf584fba26561a1905f37251d681ac100d4a0779 (patch) | |
tree | 59df84cac68eb274318d7280c900f5a2b2df714c /src/jogl/classes/com/sun | |
parent | 4d4b7c52d032d0c9302e4e16560f2e874e31b8bc (diff) |
NativeWindow extends SurfaceUpdatedListener for 'surfaceUpdated' propagation. GLDrawableFactory.createGLDrawable() propagates NativeWindow to offscreen NullWindow.
Diffstat (limited to 'src/jogl/classes/com/sun')
-rw-r--r-- | src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java | 32 | ||||
-rw-r--r-- | src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java | 2 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java index caa250597..66abcf841 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java @@ -44,6 +44,7 @@ import javax.media.nativewindow.*; import javax.media.opengl.*; import com.sun.gluegen.runtime.*; import com.sun.nativewindow.impl.NWReflection; +import com.sun.nativewindow.impl.NullWindow; import java.lang.reflect.*; /** Extends GLDrawableFactory with a few methods for handling @@ -57,43 +58,48 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { //--------------------------------------------------------------------------- // Dispatching GLDrawable construction in respect to the NativeWindow Capabilities // - public GLDrawable createGLDrawable(NativeWindow target, GLCapabilitiesChooser chooser) { - if (target == null) { + public GLDrawable createGLDrawable(NativeWindow target0, GLCapabilitiesChooser chooser) { + if (target0 == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration(); - target = NativeWindowFactory.getNativeWindow(target, config); - GLCapabilities caps = (GLCapabilities) target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); + AbstractGraphicsConfiguration config = target0.getGraphicsConfiguration().getNativeGraphicsConfiguration(); + NativeWindow target1 = NativeWindowFactory.getNativeWindow(target0, config); + GLCapabilities caps = (GLCapabilities) target1.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); GLDrawable result = null; if(caps.isOnscreen()) { if(caps.isPBuffer()) { throw new IllegalArgumentException("Onscreen target can't be PBuffer: "+caps); } if(DEBUG) { - System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable: "+target); + System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable: "+target1); } - result = createOnscreenDrawable(target); + result = createOnscreenDrawable(target1); } else { GLCapabilities caps2 = (GLCapabilities) caps.clone(); // OFFSCREEN !DOUBLE_BUFFER caps2.setDoubleBuffered(false); if(caps2.isPBuffer() && canCreateGLPbuffer()) { if(DEBUG) { - System.out.println("GLDrawableFactoryImpl.createGLDrawable -> PbufferDrawable: "+target); + System.out.println("GLDrawableFactoryImpl.createGLDrawable -> PbufferDrawable: "+target1); } result = createGLPbufferDrawable(caps2, chooser, - target.getWidth(), - target.getHeight()); + target1.getWidth(), + target1.getHeight()); } if(null==result) { if(DEBUG) { - System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OffScreenDrawable: "+target); + System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OffScreenDrawable: "+target1); } result = createOffscreenDrawable(caps2, chooser, - target.getWidth(), - target.getHeight()); + target1.getWidth(), + target1.getHeight()); + } + // Set upstream NativeWindow from caller to NullWindow for SurfaceUpdatedListener event + NativeWindow nw = result.getNativeWindow(); + if(nw instanceof NullWindow) { + ((NullWindow)nw).setUpstreamNativeWindow(target0); } } if(DEBUG) { diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java index dddba9460..020bea9f0 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java @@ -82,7 +82,7 @@ public abstract class GLDrawableImpl implements GLDrawable { ctx.getGL().glFinish(); } } - component.surfaceUpdated(this); + component.surfaceUpdated(this, component, System.currentTimeMillis()); } protected abstract void swapBuffersImpl(); |