From 1ad8c39df6b097c80ba7a85badf555e7f669cc3f Mon Sep 17 00:00:00 2001 From: Sven Gothel <sgothel@jausoft.com> Date: Sat, 24 Apr 2010 05:11:29 +0200 Subject: NEWT/AWT Interoperability - Moved all event classes to com.jogamp.newt.event and the new AWT event helper to com.jogamp.newt.awt.event - Added Newt<Type>Adapter for convenience - Added AWT<Type>Adapter for - Using AWT agnostic NEWT event listener see com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsNEWT even for AWT see com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsAWT (Nice idea by mbien) - Forwarding AWT events to NEWT (refactoring) Misc - GLDrawableFactory.shutdown() is now protected and called by the JVM shutdown hook. Hence removing the validate(). --- .../opengl/impl/x11/glx/X11GLXDrawableFactory.java | 23 ++++------------------ 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/impl/x11/glx') diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java index d8e5f7646..9a0edcfbb 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -104,17 +104,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna private X11GLXContext sharedContext=null; protected final GLDrawableImpl getSharedDrawable() { - validate(); return sharedDrawable; } protected final GLContextImpl getSharedContext() { - validate(); return sharedContext; } - public void shutdown() { - super.shutdown(); + protected void shutdown() { if (DEBUG) { System.err.println("!!! Shutdown Shared:"); System.err.println("!!! CTX : "+sharedContext); @@ -131,16 +128,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna } if(null!=sharedScreen) { X11GraphicsDevice sharedDevice = (X11GraphicsDevice) sharedScreen.getDevice(); - if(null!=sharedDevice) { - X11Util.closeThreadLocalDisplay(null); - } sharedScreen = null; } - X11Util.shutdown( !isVendorATI(), DEBUG ); + // X11Util.shutdown( !isVendorATI(), DEBUG ); // works NV .. but .. + // X11Util.shutdown( true, DEBUG ); // fails ATI, works NV .. but + X11Util.shutdown( false, DEBUG ); } public GLDrawableImpl createOnscreenDrawable(NativeWindow target) { - validate(); if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -151,7 +146,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna } protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) { - validate(); if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -162,14 +156,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna } public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) { - validate(); return glxVersionGreaterEqualThan(device, 1, 3); } private boolean glxVersionsQueried = false; private int glxVersionMajor=0, glxVersionMinor=0; public boolean glxVersionGreaterEqualThan(AbstractGraphicsDevice device, int majorReq, int minorReq) { - validate(); if (!glxVersionsQueried) { if(null == device) { device = (X11GraphicsDevice) sharedScreen.getDevice(); @@ -195,7 +187,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna } protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) { - validate(); if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -228,7 +219,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { - validate(); NullWindow nw = null; X11Lib.XLockDisplay(sharedScreen.getDevice().getHandle()); try{ @@ -243,22 +233,18 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna } public GLContext createExternalGLContext() { - validate(); return X11ExternalGLXContext.create(this, null); } public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { - validate(); return canCreateGLPbuffer(device); } public GLDrawable createExternalGLDrawable() { - validate(); return X11ExternalGLXDrawable.create(this, null); } public void loadGLULibrary() { - validate(); X11Lib.dlopen("/usr/lib/libGLU.so"); } @@ -273,7 +259,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna } public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) { - validate(); return false; } -- cgit v1.2.3