diff options
author | Sven Gothel <[email protected]> | 2013-04-16 05:50:55 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-04-16 05:50:55 +0200 |
commit | ff25c711fe4fa627004c57e0d308d06759156290 (patch) | |
tree | bccaf1561a0582b6567c064f45c2dc9f2a22596c /src/jogl/classes/javax/media/opengl | |
parent | 5b47372590ec715647ebbd75d70c41ec7a64485a (diff) |
Fix Bug 705 - Cleanup & Generalize Commit 5b47372590ec715647ebbd75d70c41ec7a64485a ; Close X11 Display in isDeviceSupported()
- Moved GL vendor version parsing to GLVersionNumber
- Moved X11Util.markAllDisplaysUnclosable() trigger into SharedResource creation of
- X11GLXDrawableFactory
- EGLDrawableFactory
- GLProfile is back to pre 5b47372590ec715647ebbd75d70c41ec7a64485a,
i.e. contains no quirk artifact (clean)
- Close X11 Display in X11GLXDrawableFactory.isDeviceSupported()
Regression of 9a4fcc7ea4ec61e4ceed791acced734ac04ea270
- TODO: Remove X11Util markAllDisplaysUnclosable detection code ?
Notes to Martin:
- Use TAB == 4 SPACES
- No author names into source code, git commit log is enough.
- No need to tag your edits, the diff is enough.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 18 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLProfile.java | 25 |
2 files changed, 10 insertions, 33 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index be947e5f5..23ca96504 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -53,6 +53,7 @@ import jogamp.opengl.GLContextImpl; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionNumber; +import com.jogamp.common.util.VersionNumberString; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.opengl.GLExtensions; @@ -126,6 +127,8 @@ public abstract class GLContext { /** Version 3.0. As an OpenGL version, it qualifies for {@link #isGL2()} only */ public static final VersionNumber Version30 = new VersionNumber(3, 0, 0); + protected static final VersionNumber Version80 = new VersionNumber(8, 0, 0); + /** <code>ARB_create_context</code> related: created via ARB_create_context. Cache key value. See {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ protected static final int CTX_IS_ARB_CREATED = 1 << 0; /** <code>ARB_create_context</code> related: desktop compatibility profile. Cache key value. See {@link #isGLCompatibilityProfile()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ @@ -169,9 +172,11 @@ public abstract class GLContext { protected VersionNumber ctxVersion; protected int ctxOptions; protected String ctxVersionString; + protected VersionNumberString ctxVendorVersion; protected VersionNumber ctxGLSLVersion; private int currentSwapInterval; protected GLRendererQuirks glRendererQuirks; + private static final VersionNumberString nullVersion = new VersionNumberString(-1, -1, -1, "n/a"); /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */ protected boolean drawableRetargeted; @@ -181,7 +186,8 @@ public abstract class GLContext { System.err.println(getThreadName() + ": GLContext.resetStates()"); // Thread.dumpStack(); } - ctxVersion = new VersionNumber(-1, -1, -1); + ctxVersion = nullVersion; + ctxVendorVersion = nullVersion; ctxOptions=0; ctxVersionString=null; ctxGLSLVersion=null; @@ -521,14 +527,9 @@ public abstract class GLContext { } public final StringBuilder append(StringBuilder sb) { - sb.append("OpenGL "); - sb.append(getGLVersionMajor()); - sb.append("."); - sb.append(getGLVersionMinor()); - sb.append(", options 0x"); + sb.append("Version ").append(getGLVersion()).append(" [GL ").append(getGLVersionNumber()).append(", vendor ").append(getGLVendorVersionNumber()); + sb.append("], options 0x"); sb.append(Integer.toHexString(ctxOptions)); - sb.append(", "); - sb.append(getGLVersion()); sb.append(", this "); sb.append(toHexString(hashCode())); sb.append(", handle "); @@ -667,6 +668,7 @@ public abstract class GLContext { * @see #getGLSLVersionNumber() **/ public final VersionNumber getGLVersionNumber() { return ctxVersion; } + public final VersionNumberString getGLVendorVersionNumber() { return ctxVendorVersion; } public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); } public final boolean isGLCoreProfile() { return ( 0 != ( CTX_PROFILE_CORE & ctxOptions ) ); } public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 54ed479a9..1b6af22d4 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -64,11 +64,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -// Added to check if X11 Displays should be closed on exit -// Martin C. Hegedus, March 30, 2013 -import com.jogamp.opengl.GLRendererQuirks; -import jogamp.nativewindow.x11.X11Util; - /** * Specifies the the OpenGL profile. * @@ -1530,26 +1525,6 @@ public class GLProfile { final boolean addedDesktopProfile = null != defaultDesktopDevice ? initProfilesForDevice(defaultDesktopDevice) : false; final boolean addedAnyProfile = addedEGLProfile || addedDesktopProfile ; - // Added to check if X11 Displays should be closed on exit - // NOTE: This checks defaultEGLDevice and defaultDesktopDevice to determine if XCloseDisplay should be called on exit - // NOTE: These checks must be done after initProfilesForDevice since GLContext must set up the renderer quirks. - // NOTE: At this point the shared resource has already opened a display, created a new context, made it current, and - // released it. Let's cross our fingers that at this point in the code the context will not be destroyed and - // the display closed under any circumstances. - // NOTE: The checks can be tricked if the default screen is using a driver other than X11 and later a X11 Display, - // such as a remote display, is opened. If this occurs then markAllDisplaysUnclosable will not have been - // correctly set. Something to deal with at a later date. - // - // Martin C. Hegedus, March 30, 2013 - if (eglFactory != null && defaultEGLDevice != null && - eglFactory.hasRendererQuirk(defaultEGLDevice,GLRendererQuirks.DontCloseX11DisplayConnection) && - NativeWindowFactory.getNativeWindowType(true) == NativeWindowFactory.TYPE_X11) - X11Util.markAllDisplaysUnclosable(); - if (desktopFactory != null && defaultDesktopDevice != null && - desktopFactory.hasRendererQuirk(defaultDesktopDevice,GLRendererQuirks.DontCloseX11DisplayConnection) && - NativeWindowFactory.getNativeWindowType(true) == NativeWindowFactory.TYPE_X11) - X11Util.markAllDisplaysUnclosable(); - if(DEBUG) { System.err.println("GLProfile.init addedAnyProfile "+addedAnyProfile+" (desktop: "+addedDesktopProfile+", egl "+addedEGLProfile+")"); System.err.println("GLProfile.init isAWTAvailable "+isAWTAvailable); |