aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-02-25 17:27:23 +0100
committerSven Gothel <[email protected]>2012-02-25 17:27:23 +0100
commit9e66972c193399d6dcdf9e6662f4335bdf15736a (patch)
treeda7d45b883edc68b1fd279c5dbaf7b9b9a8b4951 /src/jogl/classes/jogamp
parent90e4f6aa688c9730bcdedea727031d5dccb32b39 (diff)
Fix GLProfile/GLDrawableFactory bug: Recursion on default desktop device, since no profile was mapped.
GLDrawableFactory*: - Initialize defaultDevice, even if impl. is not available (no GL libraries for impl.), hence - getDefaultDevice() always returns a valid device - getIsDeviceCompatible() only returns 'true' if device is supported _and_ drawable factory is functional GLProfile: - default-desktop-device becomes default-device even if the desktop-factory itself is not functional. This is due to the fact that the subsequent EGL-factory always handles desktop-devices (X11->EGL, GDI->EGL, etc).
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java9
5 files changed, 16 insertions, 13 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index f9e8a60db..b87437088 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -547,7 +547,7 @@ public abstract class GLContextImpl extends GLContext {
ctxMajorVersion, ctxMinorVersion, ctxOptions);
GLContext.setAvailableGLVersionsSet(device);
if (DEBUG) {
- System.err.println(getThreadName() + ": createContextOLD-MapVersionsAvailable HAVE: " +reqMajor+"."+reqProfile+ " -> "+getGLVersion());
+ System.err.println(getThreadName() + ": createContextOLD-MapVersionsAvailable HAVE: " + device+" -> "+reqMajor+"."+reqProfile+ " -> "+getGLVersion());
}
}
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 2a6985d90..1ab66674b 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -70,6 +70,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
} catch (JogampRuntimeException jre) { /* n/a .. */ }
}
+ defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
+
// FIXME: Probably need to move EGL from a static model
// to a dynamic one, where there can be 2 instances
// for each ES profile with their own ProcAddressTable.
@@ -139,9 +141,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
}
- if(null != eglES1DynamicLookupHelper || null != eglES2DynamicLookupHelper) {
- defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
- }
}
protected final void destroy(ShutdownType shutdownType) {
@@ -206,7 +205,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
- return true; // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types.
+ // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types.
+ return null==eglES2DynamicLookupHelper || null==eglES1DynamicLookupHelper;
}
/**
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 91d05f945..5327f7bf5 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -97,6 +97,8 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
+
if(null!=macOSXCGLDynamicLookupHelper) {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
@@ -108,7 +110,6 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
} catch (JogampRuntimeException jre) { /* n/a .. */ }
}
- defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
sharedMap = new HashMap<String, SharedResource>();
}
}
@@ -167,7 +168,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
- if(device instanceof MacOSXGraphicsDevice) {
+ if(null!=macOSXCGLDynamicLookupHelper && device instanceof MacOSXGraphicsDevice) {
return true;
}
return false;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 6784ddded..9ddab4239 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -103,6 +103,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ defaultDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
+
if(null!=windowsWGLDynamicLookupHelper) {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
@@ -114,7 +116,6 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
} catch (JogampRuntimeException jre) { /* n/a .. */ }
}
- defaultDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
// Init shared resources off thread
@@ -379,7 +380,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
- if(device instanceof WindowsGraphicsDevice) {
+ if(null!=windowsWGLDynamicLookupHelper && device instanceof WindowsGraphicsDevice) {
return true;
}
return false;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index d356e64c6..4f333406f 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -101,12 +101,13 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT);
+
if(null!=x11GLXDynamicLookupHelper) {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
X11GLXGraphicsConfigurationFactory.registerFactory();
- defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT);
sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
// Init shared resources off thread
@@ -139,7 +140,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
X11Util.shutdown( false, DEBUG );
}
- public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
+ public final GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
return x11GLXDynamicLookupHelper;
}
@@ -219,7 +220,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
// NativeWindowFactory.getNullToolkitLock(), true); // own non-shared display connection, no locking
sharedDevice.lock();
try {
- GLXUtil.initGLXClientDataSingleton(sharedDevice);
+ GLXUtil.initGLXClientDataSingleton(sharedDevice);
final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR);
final VersionNumber glXServerVersion = GLXUtil.getGLXServerVersionNumber(sharedDevice.getHandle());
final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS));
@@ -310,7 +311,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
- if(device instanceof X11GraphicsDevice) {
+ if(null != x11GLXDynamicLookupHelper && device instanceof X11GraphicsDevice) {
return true;
}
return false;