diff options
author | Sven Gothel <sgothel@jausoft.com> | 2009-10-02 10:18:22 -0700 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2009-10-02 10:18:22 -0700 |
commit | 9fd3c095ce2117c3cb67169c97531cac78ab04c4 (patch) | |
tree | dd65dac2d4b406b7e47e92afee880d7e56cbebc5 /src/jogl/classes/com/sun/opengl/impl | |
parent | cd45d13bbd0ff1da3dac678a6461b5fdce2783c1 (diff) |
NativeWindowFactory:
- If property 'nativewindow.ws.name' is set,
use it as the custom windowing type returned by
getNativeWindowType(true)
NEWT:
- Using NativeWindowFactory's property 'nativewindow.ws.name'
as a package name for custom NEWT windowing imlementations,
ie:
-Dnativewindow.ws.name=com.sun.javafx.newt.intel.gdl
-Dnativewindow.ws.name=com.sun.javafx.newt.broadcom.egl
This allows far more flexibility to add custom impl.
- Add Intel-GDL, define property 'useIntelGDL'
to build the native part.
Intel GDL is impl in the package 'com.sun.javafx.newt.intel.gdl'
JOGL:
- All impl. of 'createGLDrawable(..)', which were actually creating
onscreen drawable only, were renamed to 'createOnscreenDrawable(..)'.
- GLDrawableFactoryImpl impl. 'createGLDrawable(..)' now
and dispatches to the actual create* methods in respect to
the Capabilities, ie onscreen, pbuffer and offscreen.
- GLDrawableFactory:
- If using a native ES profile -> EGLDrawableFactory
- If existing native OS factory -> Use that ..
- Else -> Use EGLDrawableFactory, if available
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl')
6 files changed, 50 insertions, 13 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java index 0d540647a..4597a5078 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java @@ -54,6 +54,45 @@ import java.lang.reflect.*; public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { protected static final boolean DEBUG = Debug.debug("GLDrawableFactory"); + //--------------------------------------------------------------------------- + // Dispatching GLDrawable construction in respect to the NativeWindow Capabilities + // + public GLDrawable createGLDrawable(NativeWindow target) { + if (target == null) { + throw new IllegalArgumentException("Null target"); + } + AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration(); + target = NativeWindowFactory.getNativeWindow(target, config); + GLCapabilities caps = (GLCapabilities) target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); + GLDrawable result = null; + if(caps.isOnscreen()) { + if(caps.isPBuffer()) { + throw new IllegalArgumentException("Onscreen target can't be PBuffer: "+caps); + } + result = createOnscreenDrawable(target); + } else { + if(caps.isPBuffer() && canCreateGLPbuffer()) { + // PBUFFER + result = createGLPbuffer(caps, + null /* GLCapabilitiesChooser */, + target.getWidth(), + target.getHeight(), + null /* shareContext */ ) ; + + } + if(null==result) { + result = createOffscreenDrawable(caps, + null /* GLCapabilitiesChooser */, + target.getWidth(), + target.getHeight()); + } + } + if(DEBUG) { + System.out.println("GLDrawableFactoryImpl.createGLDrawable: "+result); + } + return result; + } + /** Creates a (typically software-accelerated) offscreen GLDrawable used to implement the fallback rendering path of the GLJPanel. */ @@ -62,6 +101,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { int width, int height); + /** Creates a (typically hw-accelerated) onscreen GLDrawable. */ + public abstract GLDrawableImpl createOnscreenDrawable(NativeWindow target); + protected GLDrawableFactoryImpl() { super(); } diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java index aabc6f263..4265ee8fb 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -127,7 +127,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { eglConfig.updateGraphicsConfiguration(); } } else { - throw new GLException("EGLGraphicsConfiguration doesn't carry a EGLGraphicsDevice: "+aConfig); + throw new GLException("EGLGraphicsDevice hold by non EGLGraphicsConfiguration: "+aConfig); } } else { // create a new EGL config .. diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java index 7af45d683..cf466ef2c 100755 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java @@ -61,8 +61,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { super(); } - public GLDrawable createGLDrawable(NativeWindow target) { - target = NativeWindowFactory.getNativeWindow(target, null); + public GLDrawableImpl createOnscreenDrawable(NativeWindow target) { + if (target == null) { + throw new IllegalArgumentException("Null target"); + } return new EGLOnscreenDrawable(this, target); } @@ -81,9 +83,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final int initialWidth, final int initialHeight, final GLContext shareWith) { - if (!canCreateGLPbuffer()) { - throw new GLException("Pbuffer support not available with this EGL implementation"); - } EGLPbufferDrawable pbufferDrawable = new EGLPbufferDrawable(this, capabilities, chooser, initialWidth, initialHeight); diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java index 7bcc4ca14..024b69629 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -62,12 +62,10 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D } catch (Throwable t) { } } - public GLDrawable createGLDrawable(NativeWindow target) { + public GLDrawableImpl createOnscreenDrawable(NativeWindow target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - NativeWindowFactory factory = NativeWindowFactory.getFactory(target.getClass()); - target = NativeWindowFactory.getNativeWindow(target, null); return new MacOSXOnscreenCGLDrawable(this, target); } diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index 4d965e52b..4e02dfe92 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -71,11 +71,10 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements loadOpenGL32Library(); } - public GLDrawable createGLDrawable(NativeWindow target) { + public GLDrawableImpl createOnscreenDrawable(NativeWindow target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - target = NativeWindowFactory.getNativeWindow(target, null); return new WindowsOnscreenWGLDrawable(this, target); } diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java index acca5fe81..762ed5cac 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -65,11 +65,10 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna } catch (Throwable t) { } } - public GLDrawable createGLDrawable(NativeWindow target) { + public GLDrawableImpl createOnscreenDrawable(NativeWindow target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - target = NativeWindowFactory.getNativeWindow(target, null); return new X11OnscreenGLXDrawable(this, target); } |