aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-12 20:29:56 +0200
committerSven Gothel <[email protected]>2013-04-12 20:29:56 +0200
commit5606dd12f8086b506f33030072af5095a5871f9c (patch)
tree567f86af7d58ec538c5602319e6ea7d8ee6295c5 /src/jogl
parentcfe62741e19196d973d9b31f2c8f3873705cb74b (diff)
FBObject.init() uses safe 1x1 size like reset(..) to behave equal; GLFBODrawableImpl.contextMadeCurrent(ctx, true): Throw exception if !initialized
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/FBObject.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java33
2 files changed, 23 insertions, 22 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java
index 7d0fcfa38..6f2ac3e35 100644
--- a/src/jogl/classes/com/jogamp/opengl/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java
@@ -835,6 +835,8 @@ public class FBObject {
checkPreGLError(gl);
+ if( 0 >= width ) { width = 1; }
+ if( 0 >= height ) { height = 1; }
this.width = width;
this.height = height;
this.samples = samples <= maxSamples ? samples : maxSamples;
@@ -941,7 +943,7 @@ public class FBObject {
* @throws GLException in case of an error, i.e. size too big, etc ..
*/
public final void reset(GL gl, int newWidth, int newHeight, int newSamples, boolean resetSamplingSink) {
- if(!initialized) {
+ if( !initialized ) {
init(gl, newWidth, newHeight, newSamples);
return;
}
@@ -949,10 +951,10 @@ public class FBObject {
newSamples = newSamples <= maxSamples ? newSamples : maxSamples; // clamp
if( newWidth != width || newHeight != height || newSamples != samples ) {
- if(0>=newWidth) { newWidth = 1; }
- if(0>=newHeight) { newHeight = 1; }
- if(newWidth > 2 + maxTextureSize || newHeight> 2 + maxTextureSize ||
- newWidth > maxRenderbufferSize || newHeight> maxRenderbufferSize ) {
+ if( 0 >= newWidth ) { newWidth = 1; }
+ if( 0 >= newHeight ) { newHeight = 1; }
+ if( newWidth > 2 + maxTextureSize || newHeight > 2 + maxTextureSize ||
+ newWidth > maxRenderbufferSize || newHeight > maxRenderbufferSize ) {
throw new GLException("size "+width+"x"+height+" exceeds on of the maxima [texture "+maxTextureSize+", renderbuffer "+maxRenderbufferSize+"]");
}
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) {