summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java42
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java2
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java9
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java4
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java3
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java3
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java13
7 files changed, 59 insertions, 17 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);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 1a18a60f8..48a8fe9e0 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -126,7 +126,7 @@ public abstract class GLDrawableFactory {
} else {
// may use egl*Factory ..
if (GLProfile.DEBUG) {
- System.err.println("GLDrawableFactory.static - No Native OS Factory for: "+nativeOSType);
+ System.err.println("GLDrawableFactory.static - No native OS Factory for: "+nativeOSType+"; May use EGLDrawableFactory, if available." );
}
}
}
@@ -157,11 +157,16 @@ public abstract class GLDrawableFactory {
protected static GLDrawableFactory getFactoryImpl(String glProfileImplName) throws GLException {
if ( GLProfile.usesNativeGLES(glProfileImplName) ) {
- if(null==eglFactory) throw new GLException("GLDrawableFactory unavailable for EGL: "+glProfileImplName);
+ if(null==eglFactory) throw new GLException("EGLDrawableFactory unavailable: "+glProfileImplName);
return eglFactory;
}
- if(null==nativeOSFactory) throw new GLException("GLDrawableFactory unavailable for Native Platform "+nativeOSType);
- return nativeOSFactory;
+ if(null!=nativeOSFactory) {
+ return nativeOSFactory;
+ }
+ if(null!=eglFactory) {
+ return eglFactory;
+ }
+ throw new GLException("No native platform GLDrawableFactory, nor EGLDrawableFactory available: "+glProfileImplName);
}
/** Shuts down this GLDrawableFactory, releasing resources