summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java25
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java3
6 files changed, 28 insertions, 22 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index e2a35efb1..bc0603268 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -277,11 +277,11 @@ public abstract class GLContextImpl extends GLContext {
drawable = (GLDrawableImpl) readWrite ;
if( isCreated() && null != drawable && drawable.isRealized() ) {
int res = CONTEXT_NOT_CURRENT;
- GLException gle = null;
+ Throwable gle = null;
try {
res = makeCurrent(true); // implicit: associateDrawable(true)
- } catch ( final GLException e ) {
- gle = e;
+ } catch ( final Throwable t ) {
+ gle = t;
} finally {
if( CONTEXT_NOT_CURRENT == res ) {
// Failure, recover and bail out w/ GLException
@@ -663,19 +663,19 @@ public abstract class GLContextImpl extends GLContext {
}
}
- if (res != CONTEXT_NOT_CURRENT) { // still locked!
+ if ( CONTEXT_NOT_CURRENT != res ) { // still locked!
if( 0 == drawable.getHandle() && !surfacelessOK ) {
if( hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx) ) {
throw new GLException(String.format("Surfaceless not supported due to quirk %s: %s",
GLRendererQuirks.toString(GLRendererQuirks.NoSurfacelessCtx), toString()));
}
if( DEBUG ) {
- System.err.println(getThreadName() +": GLContext.makeCurrent: Surfaceless OK - validate");
+ System.err.println(getThreadName() +": GLContext.makeCurrent: Surfaceless OK - validated");
}
surfacelessOK = true;
}
setCurrent(this);
- if(res == CONTEXT_CURRENT_NEW) {
+ if( CONTEXT_CURRENT_NEW == res ) {
// check if the drawable's and the GL's GLProfile are equal
// throws an GLException if not
drawable.getGLProfile().verifyEquality(gl.getGLProfile());
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 68f5b57ee..37e061367 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -88,6 +88,7 @@ import com.jogamp.opengl.egl.EGL;
public class EGLDrawableFactory extends GLDrawableFactoryImpl {
protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access
+ private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG;
/* package */ static final boolean QUERY_EGL_ES_NATIVE_TK;
@@ -525,7 +526,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final int[] ctpES3ES2 = new int[] { EGLContext.CTX_PROFILE_ES };
final int[] ctpGLn = new int[] { EGLContext.CTX_PROFILE_CORE };
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.createShared(): device "+adevice);
}
@@ -584,7 +585,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
rendererQuirksES1[0], ctpES1[0],
rendererQuirksES3ES2[0], ctpES3ES2[0]);
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.createShared: devices: queried nativeTK "+QUERY_EGL_ES_NATIVE_TK+", adevice " + adevice + ", defaultDevice " + defaultDevice);
System.err.println("EGLDrawableFactory.createShared: context GLn: " + madeCurrentGLn + ", quirks "+rendererQuirksGLn[0]);
System.err.println("EGLDrawableFactory.createShared: context ES1: " + madeCurrentES1 + ", quirks "+rendererQuirksES1[0]);
@@ -607,7 +608,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final String profileString = EGLContext.getGLProfile(majorVersion[0], minorVersion[0], ctxProfile[0]);
if ( !GLProfile.isAvailable(adevice, profileString) ) {
- if( DEBUG ) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" n/a on "+adevice);
}
return false;
@@ -618,7 +619,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final boolean mapsADeviceToDefaultDevice = !QUERY_EGL_ES_NATIVE_TK || initDefaultDevice ||
null == desktopFactory;
// FIXME || adevice instanceof EGLGraphicsDevice ;
- if( DEBUG ) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" ( "+majorVersion[0]+" ), "+
"mapsADeviceToDefaultDevice "+mapsADeviceToDefaultDevice+
" (QUERY_EGL_ES_NATIVE_TK "+QUERY_EGL_ES_NATIVE_TK+", initDefaultDevice "+initDefaultDevice+", hasDesktopFactory "+(null != desktopFactory)+
@@ -651,19 +652,19 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final int quirk = GLRendererQuirks.SingletonEGLDisplayOnly;
GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
EGLDisplayUtil.setSingletonEGLDisplayOnly(true);
- if(DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Second eglGetDisplay(EGL_DEFAULT_DISPLAY) failed");
}
}
}
eglDevice = defaultDevice; // reuse
eglFeatures = defaultDeviceEGLFeatures;
- if( DEBUG ) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig.0: "+eglFeatures);
}
if( !glp.isGLES() && !eglFeatures.hasGLAPI ) {
- if(DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() OpenGL API not supported (1)");
}
} else {
@@ -687,7 +688,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
EGLContext.mapStaticGLESVersion(eglDevice, chosenCaps);
success = true;
}
- if(DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() no pbuffer config available, detected !pbuffer config: "+success);
EGLGraphicsConfigurationFactory.printCaps("!PBufferCaps", capsAnyL, System.err);
}
@@ -701,11 +702,11 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(upstreamSurface);
eglDevice.open();
eglFeatures = new EGLFeatures(eglDevice);
- if( DEBUG ) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig.1: "+eglFeatures);
}
if( !glp.isGLES() && !eglFeatures.hasGLAPI ) {
- if(DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() OpenGL API not supported (2)");
}
// disposed at finalized: eglDevice, upstreamSurface
@@ -793,7 +794,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
drawable.setRealized(false);
}
} catch (final Throwable t) {
- if(DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("Caught exception on thread "+getThreadName());
t.printStackTrace();
}
@@ -817,7 +818,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
@Override
public void releaseSharedResource(final SharedResourceRunner.Resource shared) {
final SharedResource sr = (SharedResource) shared;
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("Shutdown Shared:");
System.err.println("Device : " + sr.device);
ExceptionUtils.dumpStack(System.err);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index cb691a7ab..73e01de08 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -402,7 +402,7 @@ public class MacOSXCGLContext extends GLContextImpl
@Override
protected void copyImpl(final GLContext source, final int mask) throws GLException {
if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) {
- throw new GLException("Source/Destination OpenGL Context tyoe mismatch: source "+source+", dest: "+this);
+ throw new GLException("Source/Destination OpenGL Context type mismatch: source "+source+", dest: "+this);
}
if(!impl.copyImpl(source.getHandle(), mask)) {
throw new GLException("Error copying OpenGL Context: source "+source+", dest: "+this);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index fe054e419..933b8eef9 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -81,6 +81,8 @@ import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.GLRendererQuirks;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
+ private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG;
+
private static DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper = null;
public MacOSXCGLDrawableFactory() {
@@ -281,7 +283,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
try {
sharedContext.destroy();
} catch (final GLException gle) {
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy caught exception:");
gle.printStackTrace();
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index a81863cff..7b14a03c8 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -86,6 +86,8 @@ import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.GLRendererQuirks;
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
+ private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG;
+
/**
* Bug 1036: NVidia Windows Driver 'Threaded optimization' workaround.
* <p>
@@ -377,7 +379,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
@Override
public void releaseSharedResource(final SharedResourceRunner.Resource shared) {
final SharedResource sr = (SharedResource) shared;
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("Shutdown Shared:");
System.err.println("Device : " + sr.device);
System.err.println("Screen : " + sr.screen);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index a054d5385..35cb7d02f 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -81,6 +81,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
import com.jogamp.opengl.GLRendererQuirks;
public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
+ private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG;
public static final VersionNumber versionOneZero = new VersionNumber(1, 0, 0);
public static final VersionNumber versionOneOne = new VersionNumber(1, 1, 0);
@@ -366,7 +367,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
@Override
public void releaseSharedResource(final SharedResourceRunner.Resource shared) {
final SharedResource sr = (SharedResource) shared;
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("Shutdown Shared:");
System.err.println("Device : " + sr.device);
System.err.println("Screen : " + sr.screen);