diff options
author | Sven Gothel <[email protected]> | 2010-10-14 21:26:43 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-10-14 21:26:43 +0200 |
commit | 774138544e1eec3330309ad682fa05154a07ab8d (patch) | |
tree | a9d612e98f1d16390763f54ab1888ff66f081a22 /src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl | |
parent | d7faeb8b96f5aba76967096006af4c420d964fef (diff) |
JOGL: Reenable Applet/Webstart/RCP support for JOGL + AWT + X11
Changed GLProfile/NativeWindowFactory/.. initialization methodology:
GLProfile:
public static synchronized void initSingleton(final boolean firstUIActionOnProcess);
NativeWindowFactory:
public static synchronized void initSingleton(final boolean firstUIActionOnProcess);
+++
Introducing NativeWindow ToolkitLock, implementations are
NullToolkitLock
JAWTToolkitLock
X11JAWTToolkitLock
X11ToolkitLock
AbstractGraphicsDevice provides generic global toolkit locking methods,
implemented by the ToolkitLock interface.
ToolkitLock's are aggregated in NativeWindow's DefaultGraphicsDevice
to implement it's superclass lock()/unlock() methods.
This enables a device specific locking strategy, ie on X11/AWT utilizing
JAWT && X11 locking, and maybe none for others (NEWT).
No locking is required for X11 / AWT, in case the above mentioned
initialization happened as a 'firstUIActionOnProcess'.
The ToolkitLock factory is currently a hardcoded part of NativeWindowFactory.
We may have to allow 3rd party NativeWindow implementations
to register custom ones.
+++
com.jogamp.opengl.impl.GLDrawableImpl cleanup:
Dealing with all locking code, providing all public methods. Exceptions are commented.
Specializations x11/windows/.. only contains platform code.
Pulled down access qualifiers if possible public -> protected.
com.jogamp.nativewindow.impl.x11.X11Util
Wrapping all X11Lib method with the new locking code.
com.jogamp.nativewindow.impl.jawt.JAWTUtil
Utilize global SunToolkit.awtLock() is available,
the fallback to global JAWT.lock().
The latter just invokes the first.
javax.media.nativewindow.awt.AWTGraphicsDevice
setHandle(long handle) -> setSubType(String type, long handle)
which also resets the ToolkitLock respecting the new type.
This ensures correct locking after the sub type has been determined,
ie AWT using an X11 peer.
+++
Misc Changes done on the way ..
GLCanvas:
Fixed inversed this.drawableHelper.isExternalAnimatorAnimating() condition,
which disabled normal repaint.
GLJPanel:
Removed drawableHelper.isExternalAnimatorAnimating() condition,
which disabled painting, since the animation thread just updates the source image.
NEWT WindowImpl:
When reparenting back to parent and 'refit' child if it's size exceeds it's parent.
More 'Fix: Memory consumption' commit 6ced17f0325d5719e992b246ffd156e5b39694b4.
NEWTEvent:
Removed code to evaluate the 'system event' attribute, need to find a better approach.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl')
4 files changed, 13 insertions, 15 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java index 396d6aefc..47e0e656f 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -80,7 +80,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { try { ReflectionUtil.createInstance("com.jogamp.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory", - new Object[] {}, getClass().getClassLoader()); + null, getClass().getClassLoader()); } catch (JogampRuntimeException jre) { /* n/a .. */ } } @@ -88,14 +88,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { protected final GLDrawableImpl getSharedDrawable() { return null; } protected final GLContextImpl getSharedContext() { return null; } - public GLDrawableImpl createOnscreenDrawable(NativeSurface target) { + protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } return new MacOSXOnscreenCGLDrawable(this, target); } - protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) { + protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { return new MacOSXOffscreenCGLDrawable(this, target); } @@ -120,14 +120,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { return new MacOSXPbufferCGLDrawable(this, target); } - protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { + protected NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(); ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen, true)); ns.setSize(width, height); return ns; } - public GLContext createExternalGLContext() { + protected GLContext createExternalGLContextImpl() { return MacOSXExternalCGLContext.create(this, null); } @@ -135,7 +135,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { return false; } - public GLDrawable createExternalGLDrawable() { + protected GLDrawable createExternalGLDrawableImpl() { // FIXME throw new GLException("Not yet implemented"); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java index ada5fb1a7..69bb245e1 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java @@ -51,9 +51,8 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GraphicsConfiguration GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.macosx.MacOSXGraphicsDevice.class, this); } - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities, - CapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen) { + protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( + Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { return chooseGraphicsConfigurationStatic(capabilities, chooser, absScreen, false); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java index bc470383f..14ed02918 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -77,7 +77,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { if(realized) { createPbuffer(); } else { - destroy(); + destroyImpl(); } } @@ -85,7 +85,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { return new MacOSXPbufferCGLContext(this, shareWith); } - public void destroy() { + protected void destroyImpl() { if (this.pBuffer != 0) { NativeSurface ns = getNativeSurface(); impl.destroy(pBuffer); @@ -185,7 +185,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { if (haveSetOpenGLMode) { throw new GLException("Can't switch between using NSOpenGLPixelBuffer and CGLPBufferObj more than once"); } - destroy(); + destroyImpl(); openGLMode = mode; haveSetOpenGLMode = true; if (DEBUG) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java index 0d59da32e..6a9617d27 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java @@ -53,9 +53,8 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.awt.AWTGraphicsDevice.class, this); } - public AbstractGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities, - CapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen) { + protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( + Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { GraphicsDevice device = null; if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { |