From 711757aa4e087d97c3103489c47fbd7d76bcac3d Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sat, 20 Sep 2014 02:51:44 +0200
Subject: FBObject: Simplify API (init/reset); Only issue automatic
 resetSamplingSink(..) if required; Fix resetSamplingSink(..), isBound(), ..

- Simplify API (init/reset)
  - use new unique methods for init and reset:
    - void init(final GL gl, final int newWidth, final int newHeight, final int newSamples)
      - does not issue resetSamplingSink(..)
    - boolean reset(final GL gl, final int newWidth, final int newHeight, final int newSamples)
      - always issues resetSamplingSink(..)

  - deprecated dual-use (init/reset):
    - boolean reset(final GL gl, final int newWidth, final int newHeight)
    - boolean reset(final GL gl, int newWidth, int newHeight, int newSamples, final boolean resetSamplingSink)

- reset(..) no more creates a dummy 'samplingSink' instance if sampling > 0,
  left up to resetSamplingSink(..)

- Track 'modified' state of FBObject,
  if size, format or any attachment has been changed since last
    - use(..)
    - syncSamplingSink(..)
    - resetSamplingSink(..)

- Only issue resetSamplingSink(..) from syncSamplingSink(..)/use(..)
  if 'modified == true'

+++

- Fix setSamplingSink(..), i.e. samplingSink state handling:
  - Validated whether given samplingSink is initialized,
    throws Exception if not.

- Fix resetSamplingSink(..)
  - resets the bound state, i.e. leaves it untouched
    - also unbinds the samplingSink

  - sampleSinkDepthStencilMismatch() also returns true if
    this.depth/stencil == null, but samplingSink is not.

  - Newly created colorbuffer/-texture matches
    exiting colorbuffer's internal-format, if exists.

  - Using simplified resetSizeImpl(..) for size mismatch

  - Simplified samplingColorSink init check

- Fix isBound()
    was: 'bound = bound && fbName != gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER)'
    fix: 'bound = bound && fbName == gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER)'

- Fix detachRenderbuffer(..) validates whether detachment was successful,
  similar to detachColorbuffer(..)
---
 src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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

diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index f3954b7b6..1bdc99a9b 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -107,7 +107,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
         final FBObject fbo = new FBObject();
         fbos[idx] = fbo;
 
-        fbo.reset(gl, width, height, samples, false);
+        fbo.init(gl, width, height, samples);
         if(fbo.getNumSamples() != samples) {
             throw new InternalError("Sample number mismatch: "+samples+", fbos["+idx+"] "+fbo);
         }
@@ -128,7 +128,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
         if(samples > 0) {
             final FBObject ssink = new FBObject();
             {
-                ssink.reset(gl, width, height);
+                ssink.init(gl, width, height, 0);
                 if( !useTexture ) {
                     ssink.attachColorbuffer(gl, 0, useAlpha);
                 } else {
@@ -243,7 +243,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
         final boolean useDepth   = 0 != ( FBOMODE_USE_DEPTH   & fboModeBits );
         if( !fboResetQuirk ) {
             try {
-                fbos[idx].reset(gl, width, height, samples, false);
+                fbos[idx].reset(gl, width, height, samples);
                 if(fbos[idx].getNumSamples() != samples) {
                     throw new InternalError("Sample number mismatch: "+samples+", fbos["+idx+"] "+fbos[idx]);
                 }
-- 
cgit v1.2.3