aboutsummaryrefslogtreecommitdiffstats
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.java21
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java6
2 files changed, 24 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index bf6a0ee6e..e82756022 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -266,11 +266,16 @@ public abstract class GLContextImpl extends GLContext {
if ( !lock.isOwner(Thread.currentThread()) ) {
throw new GLException("Context not current on current thread "+Thread.currentThread().getName()+": "+this);
}
+ Throwable drawableContextMadeCurrentException = null;
final boolean actualRelease = ( inDestruction || lock.getHoldCount() == 1 ) && 0 != contextHandle;
try {
if( actualRelease ) {
if( !inDestruction ) {
- drawable.contextMadeCurrent(this, false);
+ try {
+ drawable.contextMadeCurrent(this, false);
+ } catch (Throwable t) {
+ drawableContextMadeCurrentException = t;
+ }
}
releaseImpl();
}
@@ -285,6 +290,10 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() +": GLContext.ContextSwitch: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+" - "+(actualRelease?"switch":"keep ")+" - CONTEXT_RELEASE - "+lock);
}
}
+ if(null != drawableContextMadeCurrentException) {
+ throw new GLException("GLContext.release(false) during GLDrawableImpl.contextMadeCurrent(this, false)", drawableContextMadeCurrentException);
+ }
+
}
protected abstract void releaseImpl() throws GLException;
@@ -300,6 +309,7 @@ public abstract class GLContextImpl extends GLContext {
// this would be odd ..
throw new GLException("Surface not ready to lock: "+drawable);
}
+ Throwable drawableContextRealizedException = null;
try {
// Must hold the lock around the destroy operation to make sure we
// don't destroy the context while another thread renders to it.
@@ -320,7 +330,11 @@ public abstract class GLContextImpl extends GLContext {
// needs current context to disable debug handler
makeCurrent();
}
- drawable.contextRealized(this, false);
+ try {
+ drawable.contextRealized(this, false);
+ } catch (Throwable t) {
+ drawableContextRealizedException = t;
+ }
glDebugHandler.enable(false);
if(lock.getHoldCount() > 1) {
// pending release() after makeCurrent()
@@ -343,6 +357,9 @@ public abstract class GLContextImpl extends GLContext {
} finally {
drawable.unlockSurface();
}
+ if(null != drawableContextRealizedException) {
+ throw new GLException("GLContext.destroy() during GLDrawableImpl.contextRealized(this, false)", drawableContextRealizedException);
+ }
}
resetStates();
}
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index b7ea4f826..03bc26cbc 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -69,8 +69,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl {
fbo.bind(gl);
} else {
fbo.unbind(gl);
+ final TextureAttachment attachment = samples > 0 ? fbo.getSamplingSink() : (TextureAttachment) fbo.getColorbuffer(0) ;
+ if(null == attachment) {
+ throw new GLException("Null texture colorbuffer, samples "+samples+", "+fbo.toString());
+ }
gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit);
- fbo.use(gl, samples > 0 ? fbo.getSamplingSink() : (TextureAttachment) fbo.getColorbuffer(0) );
+ fbo.use(gl, attachment );
if( samples > 0) {
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, fbo.getReadFramebuffer());
}