aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/FBObject.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-21 20:26:31 +0200
committerSven Gothel <[email protected]>2012-09-21 20:26:31 +0200
commit495a1fbd591dfd9c428d9be660c3db33b7cb7aae (patch)
tree34c5998b95eec3ecfa31db18044934ecde7435ad /src/jogl/classes/com/jogamp/opengl/FBObject.java
parent459af1bba130495943e51ff289a094b602c642cd (diff)
FBObject: Small cleanup of freeColorbufferImpl(gl, i) -> freeAllColorbufferImpl(gl)
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/FBObject.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/FBObject.java53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java
index ca9e3d370..59d1c9fa6 100644
--- a/src/jogl/classes/com/jogamp/opengl/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java
@@ -60,6 +60,7 @@ import com.jogamp.opengl.FBObject.Attachment.Type;
public class FBObject {
protected static final boolean DEBUG = Debug.debug("FBObject");
private static final boolean forceMinimumFBOSupport = Debug.isPropertyDefined("jogl.fbo.force.min", true);
+ private static final boolean FBOResizeQuirk = false;
private static enum DetachAction { NONE, DISPOSE, RECREATE };
@@ -1592,30 +1593,32 @@ public class FBObject {
return colbuf;
}
- private final void freeColorbufferImpl(GL gl, int attachmentPoint) {
- Colorbuffer colbuf = colorAttachmentPoints[attachmentPoint]; // shortcut, don't validate here
-
- if(null == colbuf) {
- return;
- }
-
- if(colbuf instanceof TextureAttachment) {
- final TextureAttachment texA = (TextureAttachment) colbuf;
- if( 0 != texA.getName() ) {
- gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER,
- GL.GL_COLOR_ATTACHMENT0 + attachmentPoint,
- GL.GL_TEXTURE_2D, 0, 0);
- gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
+ private final void freeAllColorbufferImpl(GL gl) {
+ for(int i=0; i<maxColorAttachments; i++) {
+ final Colorbuffer colbuf = colorAttachmentPoints[i]; // shortcut, don't validate here
+
+ if(null == colbuf) {
+ return;
}
- texA.free(gl);
- } else if(colbuf instanceof ColorAttachment) {
- final ColorAttachment colA = (ColorAttachment) colbuf;
- if( 0 != colA.getName() ) {
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
- GL.GL_COLOR_ATTACHMENT0+attachmentPoint,
- GL.GL_RENDERBUFFER, 0);
+
+ if(colbuf instanceof TextureAttachment) {
+ final TextureAttachment texA = (TextureAttachment) colbuf;
+ if( 0 != texA.getName() ) {
+ gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER,
+ GL.GL_COLOR_ATTACHMENT0 + i,
+ GL.GL_TEXTURE_2D, 0, 0);
+ gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
+ }
+ texA.free(gl);
+ } else if(colbuf instanceof ColorAttachment) {
+ final ColorAttachment colA = (ColorAttachment) colbuf;
+ if( 0 != colA.getName() ) {
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
+ GL.GL_COLOR_ATTACHMENT0 + i,
+ GL.GL_RENDERBUFFER, 0);
+ }
+ colA.free(gl);
}
- colA.free(gl);
}
}
@@ -1832,8 +1835,6 @@ public class FBObject {
detachRenderbufferImpl(gl, Attachment.Type.DEPTH_STENCIL, DetachAction.DISPOSE);
}
- static final boolean FBOResizeQuirk = false;
-
private final void detachAllImpl(GL gl, boolean detachNonColorbuffer, boolean recreate) {
if( !isInitialized() ) {
return;
@@ -1844,9 +1845,7 @@ public class FBObject {
if(FBOResizeQuirk) {
if(detachNonColorbuffer && recreate) {
// free all colorbuffer & renderbuffer 1st
- for(int i=0; i<maxColorAttachments; i++) {
- freeColorbufferImpl(gl, i);
- }
+ freeAllColorbufferImpl(gl);
freeAllRenderbufferImpl(gl);
}
}