diff options
Diffstat (limited to 'src/jogl/classes/javax/media')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 13 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLDrawableFactory.java | 12 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLProfile.java | 25 |
3 files changed, 33 insertions, 17 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 766533aab..0bf4abab6 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -41,6 +41,8 @@ package javax.media.opengl; import java.nio.IntBuffer; +import java.security.AccessControlContext; +import java.security.AccessController; import java.util.HashMap; import java.util.HashSet; import javax.media.nativewindow.AbstractGraphicsDevice; @@ -63,10 +65,17 @@ import jogamp.opengl.GLContextImpl; abstraction provides a stable object which clients can use to refer to a given context. */ public abstract class GLContext { + /** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */ - public final static boolean DEBUG_GL = Debug.debug("DebugGL"); + public final static boolean DEBUG_GL; /** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */ - public final static boolean TRACE_GL = Debug.debug("TraceGL"); + public final static boolean TRACE_GL; + + static { + final AccessControlContext acl = AccessController.getContext(); + DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true, acl); + TRACE_GL = Debug.isPropertyDefined("jogl.debug.TraceGL", true, acl); + } /** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */ public static final int CONTEXT_NOT_CURRENT = 0; diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 5fc977581..1340b661d 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -260,19 +260,17 @@ public abstract class GLDrawableFactory { } /** - * Returns true if a shared context is already mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()}, - * or if a new shared context could be created and mapped. Otherwise return false.<br> - * Creation of the shared context is tried only once. + * Returns true if a shared context could be created while initialization + * of shared resources for <code>device</code> {@link AbstractGraphicsDevice#getConnection()}.<br> + * This does not imply a shared context is mapped, but was available<br>. * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. */ - public final boolean getIsSharedContextAvailable(AbstractGraphicsDevice device) { - return null != getOrCreateSharedContext(device); - } + public abstract boolean getWasSharedContextCreated(AbstractGraphicsDevice device); /** * Returns the shared context mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()}, - * either a preexisting or newly created, or <code>null</code> if creation failed or not supported.<br> + * either a pre-existing or newly created, or <code>null</code> if creation failed or not supported.<br> * Creation of the shared context is tried only once. * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index f5f2e5389..0f502ce32 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -1202,7 +1202,7 @@ public class GLProfile { if(null != desktopFactory) { DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0); if(null!=glLookupHelper) { - hasDesktopGLFactory = glLookupHelper.hasGLBinding(); + hasDesktopGLFactory = glLookupHelper.isLibComplete() && hasGL234Impl; } } } catch (LinkageError le) { @@ -1279,7 +1279,7 @@ public class GLProfile { final boolean addedAnyProfile = addedDesktopProfile || addedEGLProfile ; if(DEBUG) { - System.err.println("GLProfile.init addedAnyProfile(e/d) "+addedAnyProfile+" ("+addedDesktopProfile+"/"+addedEGLProfile+")"); + System.err.println("GLProfile.init addedAnyProfile(d/e) "+addedAnyProfile+" ("+addedDesktopProfile+"/"+addedEGLProfile+")"); System.err.println("GLProfile.init isAWTAvailable "+isAWTAvailable); System.err.println("GLProfile.init hasDesktopGLFactory "+hasDesktopGLFactory); System.err.println("GLProfile.init hasGL234Impl "+hasGL234Impl); @@ -1324,14 +1324,16 @@ public class GLProfile { boolean addedDesktopProfile = false; boolean addedEGLProfile = false; - - if( hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device)) { + boolean deviceIsDesktopCompatible = false; + boolean deviceIsEGLCompatible = false; + + if( hasDesktopGLFactory && ( deviceIsDesktopCompatible = desktopFactory.getIsDeviceCompatible(device)) ) { // 1st pretend we have all Desktop and EGL profiles .. computeProfileMap(device, true /* desktopCtxUndef*/, true /* esCtxUndef */); // Triggers eager initialization of share context in GLDrawableFactory for the device, // hence querying all available GLProfiles - boolean desktopSharedCtxAvail = desktopFactory.getIsSharedContextAvailable(device); + boolean desktopSharedCtxAvail = desktopFactory.getWasSharedContextCreated(device); if (DEBUG) { System.err.println("GLProfile.initProfilesForDevice: "+device+": desktop Shared Ctx "+desktopSharedCtxAvail); } @@ -1343,13 +1345,14 @@ public class GLProfile { 1, 5, GLContext.CTX_PROFILE_COMPAT|GLContext.CTX_OPTION_ANY); } addedDesktopProfile = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */); - } else if( null!=eglFactory && ( hasGLES2Impl || hasGLES1Impl ) && eglFactory.getIsDeviceCompatible(device)) { + } else if( hasEGLFactory && ( hasGLES2Impl || hasGLES1Impl ) && + ( deviceIsEGLCompatible = eglFactory.getIsDeviceCompatible(device)) ) { // 1st pretend we have all EGL profiles .. computeProfileMap(device, false /* desktopCtxUndef*/, true /* esCtxUndef */); // Triggers eager initialization of share context in GLDrawableFactory for the device, // hence querying all available GLProfiles - boolean eglSharedCtxAvail = eglFactory.getIsSharedContextAvailable(device); + boolean eglSharedCtxAvail = eglFactory.getWasSharedContextCreated(device); if (DEBUG) { System.err.println("GLProfile.initProfilesForDevice: "+device+": egl Shared Ctx "+eglSharedCtxAvail); } @@ -1371,7 +1374,13 @@ public class GLProfile { } else { setProfileMap(device, new HashMap()); // empty if(DEBUG) { - System.err.println("GLProfile: EGLFactory - Device is not available: "+device); + System.err.println("GLProfile: device could not be initialized: "+device); + System.err.println("GLProfile: compatible w/ desktop: "+deviceIsDesktopCompatible+ + ", egl "+deviceIsEGLCompatible); + System.err.println("GLProfile: desktoplFactory "+desktopFactory); + System.err.println("GLProfile: eglFactory "+eglFactory); + System.err.println("GLProfile: hasGLES1Impl "+hasGLES1Impl); + System.err.println("GLProfile: hasGLES2Impl "+hasGLES2Impl); } } |