aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/GLProfile.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-04-27 19:45:43 +0200
committerSven Gothel <[email protected]>2010-04-27 19:45:43 +0200
commit897c7248f9895d828542d524b211b74efcc715d2 (patch)
tree2b6ddc670320f5372b9d4a1a686d9e453e63ce82 /src/jogl/classes/javax/media/opengl/GLProfile.java
parentb5fc2499749d9c180d3e5a0e04a939bd78017068 (diff)
JOGL Error Handling
- Catch invalid drawable for all impl. at GLContextImpl if !created yet - GLDrawableFactoryImpl (X11/WGL) catch and fwd Throwable properly - GLProfile catch LinkageError and handle it In case of nothing is available, a final ExceptionInInitializer will be thrown, with the produced GLException that no GLProfile is available.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/GLProfile.java')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java70
1 files changed, 39 insertions, 31 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 0e10b32b3..cbf50a94d 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -864,11 +864,9 @@ public class GLProfile implements Cloneable {
} catch (RuntimeException re) {
t=re;
}
- if(null!=t) {
- if (DEBUG) {
- System.err.println("GLProfile.static Desktop GLES12 Library not available");
- t.printStackTrace();
- }
+ if(DEBUG && null!=t) {
+ System.err.println("GLProfile.static Desktop GLES12 Library not available");
+ t.printStackTrace();
}
@@ -890,12 +888,18 @@ public class GLProfile implements Cloneable {
//
if(hasDesktopGL||hasDesktopGLES12) {
+ t=null;
// if successfull it has a shared dummy drawable and context created
try {
hasNativeOSFactory = null != GLDrawableFactory.getFactoryImpl(GL2);
+ } catch (LinkageError le) {
+ t=le;
} catch (RuntimeException re) {
+ t=re;
+ }
+ if(DEBUG && null!=t) {
System.err.println("GLProfile.static - Native platform GLDrawable factory not available");
- re.printStackTrace();
+ t.printStackTrace();
}
}
@@ -923,33 +927,26 @@ public class GLProfile implements Cloneable {
hasGL2ES12Impl = hasGL2ES12Impl && GLContext.isGL2Available();
}
- boolean btest = false;
-
boolean hasEGLDynLookup = ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.egl.EGLDynamicLookupHelper");
boolean hasEGLDrawableFactory = false;
- t=null;
- try {
- if(hasEGLDynLookup) {
+ boolean btest = false;
+ if(hasEGLDynLookup) {
+ t=null;
+ try {
hasEGLDrawableFactory = null!=GLDrawableFactory.getFactoryImpl(GLES2);
- try {
- btest = hasEGLDrawableFactory &&
- ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.es2.GLES2Impl") &&
- null!=com.jogamp.opengl.impl.egl.EGLDynamicLookupHelper.getDynamicLookupHelper(2);
- } catch (GLException gle) {
- // n/a ..
- }
+ btest = hasEGLDrawableFactory &&
+ ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.es2.GLES2Impl") &&
+ null!=com.jogamp.opengl.impl.egl.EGLDynamicLookupHelper.getDynamicLookupHelper(2);
+ } catch (LinkageError le) {
+ t=le;
+ } catch (SecurityException se) {
+ t=se;
+ } catch (NullPointerException npe) {
+ t=npe;
+ } catch (RuntimeException re) {
+ t=re;
}
- } catch (UnsatisfiedLinkError ule) {
- t=ule;
- } catch (SecurityException se) {
- t=se;
- } catch (NullPointerException npe) {
- t=npe;
- } catch (RuntimeException re) {
- t=re;
- }
- if(null!=t) {
- if (DEBUG) {
+ if(DEBUG && null!=t) {
System.err.println("GLProfile.static - GL ES2 Factory/Library not available");
t.printStackTrace();
}
@@ -961,12 +958,23 @@ public class GLProfile implements Cloneable {
btest = false;
if(hasEGLDynLookup) {
+ t=null;
try {
btest = hasEGLDrawableFactory &&
ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.es1.GLES1Impl") &&
null!=com.jogamp.opengl.impl.egl.EGLDynamicLookupHelper.getDynamicLookupHelper(1);
- } catch (GLException jre) {
- /* just not available .. */
+ } catch (LinkageError le) {
+ t=le;
+ } catch (SecurityException se) {
+ t=se;
+ } catch (NullPointerException npe) {
+ t=npe;
+ } catch (RuntimeException re) {
+ t=re;
+ }
+ if(DEBUG && null!=t) {
+ System.err.println("GLProfile.static - GL ES1 Factory/Library not available");
+ t.printStackTrace();
}
}
hasGLES1Impl = btest;