From 61bb64aea9d8967f5360ba42fc9ec7a24b79683b Mon Sep 17 00:00:00 2001 From: Sven Gothel <sgothel@jausoft.com> Date: Sat, 13 Oct 2012 07:10:52 +0200 Subject: Fix Windows ANGLE Workaround Regression of commit 923d9dd7f1d40db72d35ca76a761ca14babf147f We are aware that Google's ANGLE (Windows EGL/ES2 impl. based on D3D) crashes using eglInitialize(..) w/ EGL_DEFAULT_DISPLAY. Commit 923d9dd7f1d40db72d35ca76a761ca14babf147f moved the EGL device initialization into the EGLDrawableFactory ctor and hence slipped out ANGLE workaround to disable it per default. - Moving property static flags from GLProfile -> GLDrawableFactory - Moving ANGLE workaround right into EGLDrawableFactory (where it belongs) - Moving optional EGL/ES disable code to GLDrawableFactory (where it belongs) Tested on Windows w/ Java-32bit and latest Chrome ANGLE DLLs --- .../javax/media/opengl/GLDrawableFactory.java | 51 ++++++++++++++++------ 1 file changed, 37 insertions(+), 14 deletions(-) (limited to 'src/jogl/classes/javax/media/opengl/GLDrawableFactory.java') diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index ae49eeeff..70480e728 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -97,9 +97,28 @@ import jogamp.opengl.Debug; */ public abstract class GLDrawableFactory { + protected static final boolean DEBUG = Debug.debug("GLDrawable"); + + /** + * We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome. + * When run in the mentioned browsers, the eglInitialize(..) implementation crashes. + * <p> + * This can be overridden by explicitly enabling ANGLE on Windows by setting the property + * <code>jogl.enable.ANGLE</code>. + * </p> + */ + protected static final boolean enableANGLE = Debug.isPropertyDefined("jogl.enable.ANGLE", true); + + /** + * In case no OpenGL ES implementation is required + * and if the running platform may have a buggy implementation, + * setting the property <code>jogl.disable.opengles</code> disables querying a possible existing OpenGL ES implementation. + */ + protected static final boolean disableOpenGLES = Debug.isPropertyDefined("jogl.disable.opengles", true); + static final String macosxFactoryClassNameCGL = "jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory"; static final String macosxFactoryClassNameAWTCGL = "jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory"; - + private static volatile boolean isInit = false; private static GLDrawableFactory eglFactory; private static GLDrawableFactory nativeOSFactory; @@ -144,19 +163,19 @@ public abstract class GLDrawableFactory { } } else { // may use egl*Factory .. - if (GLProfile.DEBUG) { + if (DEBUG || GLProfile.DEBUG) { System.err.println("GLDrawableFactory.static - No native Windowing Factory for: "+nwt+"; May use EGLDrawableFactory, if available." ); } } } if (null != factoryClassName) { - if (GLProfile.DEBUG) { + if (DEBUG || GLProfile.DEBUG) { System.err.println("GLDrawableFactory.static - Native OS Factory for: "+nwt+": "+factoryClassName); } try { tmp = (GLDrawableFactory) ReflectionUtil.createInstance(factoryClassName, cl); } catch (JogampRuntimeException jre) { - if (GLProfile.DEBUG) { + if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: GLDrawableFactory.static - Native Platform: "+nwt+" - not available: "+factoryClassName); jre.printStackTrace(); } @@ -165,18 +184,22 @@ public abstract class GLDrawableFactory { if(null != tmp && tmp.isComplete()) { nativeOSFactory = tmp; } - tmp = null; - try { - tmp = (GLDrawableFactory) ReflectionUtil.createInstance("jogamp.opengl.egl.EGLDrawableFactory", cl); - } catch (JogampRuntimeException jre) { - if (GLProfile.DEBUG) { - System.err.println("Info: GLDrawableFactory.static - EGLDrawableFactory - not available"); - jre.printStackTrace(); + + if(!disableOpenGLES) { + try { + tmp = (GLDrawableFactory) ReflectionUtil.createInstance("jogamp.opengl.egl.EGLDrawableFactory", cl); + } catch (JogampRuntimeException jre) { + if (DEBUG || GLProfile.DEBUG) { + System.err.println("Info: GLDrawableFactory.static - EGLDrawableFactory - not available"); + jre.printStackTrace(); + } } - } - if(null != tmp && tmp.isComplete()) { - eglFactory = tmp; + if(null != tmp && tmp.isComplete()) { + eglFactory = tmp; + } + } else if( DEBUG || GLProfile.DEBUG ) { + System.err.println("Info: GLDrawableFactory.static - EGLDrawableFactory - disabled!"); } } -- cgit v1.2.3