From 5606dd12f8086b506f33030072af5095a5871f9c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 12 Apr 2013 20:29:56 +0200 Subject: FBObject.init() uses safe 1x1 size like reset(..) to behave equal; GLFBODrawableImpl.contextMadeCurrent(ctx, true): Throw exception if !initialized --- .../classes/jogamp/opengl/GLFBODrawableImpl.java | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java') diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index ac10e2728..85f63b52c 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -335,16 +335,17 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { protected final void contextMadeCurrent(GLContext glc, boolean current) { final GL gl = glc.getGL(); if(current) { + if( !initialized ) { + throw new GLException("Not initialized: "+this); + } fbos[fboIBack].bind(gl); fboBound = true; - } else { - if(fboBound) { - swapFBOImpl(glc); - swapFBOImplPost(glc); - fboBound=false; - if(DEBUG_SWAP) { - System.err.println("Post FBO swap(@release): done"); - } + } else if( fboBound ) { + swapFBOImpl(glc); + swapFBOImplPost(glc); + fboBound=false; + if(DEBUG_SWAP) { + System.err.println("Post FBO swap(@release): done"); } } } @@ -353,17 +354,15 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { protected void swapBuffersImpl(boolean doubleBuffered) { final GLContext ctx = GLContext.getCurrent(); boolean doPostSwap = false; - if(null!=ctx && ctx.getGLDrawable()==this) { - if(fboBound) { - swapFBOImpl(ctx); - doPostSwap = true; - fboBound=false; - if(DEBUG_SWAP) { - System.err.println("Post FBO swap(@swap): done"); - } + if( null != ctx && ctx.getGLDrawable() == this && fboBound ) { + swapFBOImpl(ctx); + doPostSwap = true; + fboBound=false; + if(DEBUG_SWAP) { + System.err.println("Post FBO swap(@swap): done"); } } - if(null != swapBufferContext) { + if( null != swapBufferContext ) { swapBufferContext.swapBuffers(doubleBuffered); } if(doPostSwap) { -- cgit v1.2.3