diff options
author | Sven Gothel <[email protected]> | 2012-11-08 18:10:47 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-11-08 18:10:47 +0100 |
commit | 3b57e34459703b2755f9c432e36beff596850b91 (patch) | |
tree | df3963a9fd78e0e87dcfc09446f20c95433c1656 /src/jogl | |
parent | d0f91a8ed17fbb1a7b56511c4e53a29e576f01af (diff) |
Bug 634 - Part 1: Fix FBObject regression of commit dbc260bd2e917ee9001461749c99da0c9cbfaf9a
- init(..): Query MAX_COLOR_ATTACHMENTS: Remove erroneous samplingSink null check (it's always null)
- reset(..): Create & construct samplingSink if required and missing before detaching all (due to bind)
- setSamplingSink(..) returns previous samplingSink
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/FBObject.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index d91650004..40b45ead2 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -810,7 +810,7 @@ public class FBObject { int realMaxColorAttachments = 1; maxColorAttachments = 1; - if( null != samplingSink && fullFBOSupport || NV_fbo_color_attachments ) { + if( fullFBOSupport || NV_fbo_color_attachments ) { try { gl.glGetIntegerv(GL2GL3.GL_MAX_COLOR_ATTACHMENTS, val, 0); realMaxColorAttachments = 1 <= val[0] ? val[0] : 1; // cap minimum to 1 @@ -841,7 +841,6 @@ public class FBObject { if(DEBUG) { System.err.println("FBObject "+width+"x"+height+", "+samples+" -> "+this.samples+" samples"); System.err.println("fullFBOSupport: "+fullFBOSupport); - System.err.println("isSamplesSink: "+(null == samplingSink)); System.err.println("maxColorAttachments: "+maxColorAttachments+"/"+realMaxColorAttachments+" [capped/real]"); System.err.println("maxSamples: "+maxSamples); System.err.println("maxTextureSize: "+maxTextureSize); @@ -965,6 +964,12 @@ public class FBObject { width = newWidth; height = newHeight; samples = newSamples; + + if(0 < samples && null == samplingSink ) { + // needs valid samplingSink for detach*() -> bind() + samplingSink = new FBObject(); + samplingSink.init(gl, width, height, 0); + } detachAllImpl(gl, true , true); if(resetSamplingSink) { resetSamplingSink(gl); @@ -2030,10 +2035,12 @@ public class FBObject { /** * Setting this FBO sampling sink. - * @param newSamplingSink the new FBO sampling sink to use, or null to remove current sampling sink + * @param newSamplingSink the new FBO sampling sink to use, or null to remove current sampling sink + * @return the previous sampling sink or null if none was attached * @throws GLException if this FBO doesn't use MSAA or the given sink uses MSAA itself */ - public void setSamplingSink(FBObject newSamplingSink) throws GLException { + public FBObject setSamplingSink(FBObject newSamplingSink) throws GLException { + final FBObject prev = samplingSink; if( null == newSamplingSink) { samplingSink = null; samplingSinkTexture = null; @@ -2047,6 +2054,7 @@ public class FBObject { throw new GLException("Setting SamplingSink for non MSAA FBO not allowed: "+this); } samplingSinkDirty = true; + return prev; } /** |