From e96882ae569c681e1b28da6701bf547f6dd9eda8 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Mon, 28 Jul 2014 15:29:59 +0200
Subject: Bug 1037 - FBObject/GLFBODrawable: Do not assume using a
 TextureAttachment for a Colorbuffer, also make DEPTH optional.

API Change

+++

In certain cases a TextureAttachment for the FBO's color buffer
is not desired, either for performance reasons where texture functionality
is not required or to avoid texture restrictions like size, etc.

+++

GLFBODrawable shall use TextureAttachment for the FBO's color buffer
and a DEPTH buffer per default.
However, the user shall be allowed to use a plain ColorAttachment (renderbuffer)
and also no DEPTH buffer.

+++

FBObject Details:
 - Colorbuffer interface exposes Attachment details
   like format, size, etc as well as it's implementation
   specifics, isTextureAttachment() and getTextureAttachment() allowing a clean cast and type query.

 - Allow ColorAttachment to be used for non MSAA

 - Make TextureAttachment optional for method 'use(GL, TextureAttachment)'

 - Only validate size against MAX_TEXTURESIZE if using a TextureAttachment

 - API Change:
   - rename: getColorAttachmentCount() -> getColorbufferCount()
   - add: getTextureAttachmentCount()
   - change 'TextureAttachment getSamplingSink()' -> 'Colorbuffer getSamplingSink()'
---
 src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/jogl/classes/jogamp/graph/curve/opengl')

diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index fa81e2a3f..ca50b5d2d 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -427,7 +427,7 @@ public class VBORegion2PMSAAES2  extends GLRegion {
 
         gl.glActiveTexture(GL.GL_TEXTURE0 + gcu_FboTexUnit.intValue());
 
-        fbo.use(gl, fbo.getSamplingSink());
+        fbo.use(gl, fbo.getSamplingSink().getTextureAttachment());
         gca_FboVerticesAttr.enableBuffer(gl, true);
         gca_FboTexCoordsAttr.enableBuffer(gl, true);
         indicesFbo.bindBuffer(gl, true); // keeps VBO binding
@@ -457,7 +457,10 @@ public class VBORegion2PMSAAES2  extends GLRegion {
             fbo.reset(gl, fboWidth, fboHeight, sampleCount[0], false);
             sampleCount[0] = fbo.getNumSamples();
             fbo.attachColorbuffer(gl, 0, true);
-            fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+            if( !blendingEnabled ) {
+                // no depth-buffer w/ blending
+                fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+            }
             final FBObject ssink = new FBObject();
             {
                 ssink.reset(gl, fboWidth, fboHeight);
-- 
cgit v1.2.3