From 9505d48f1702e2ba8c9e72edcbb8fab5ad01bc56 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sat, 26 Jan 2013 05:21:17 +0100
Subject: FBObject/GLFBODrawableImpl: Silence stderr if not in DEBUG mode
 relying on application handling verbosity and debug output

The following cases were dumping states on stderr:
  - FBOObject.isStatusValid() if false
    -> Only dumps if DEBUG

  - GLFBODrawableImpl.reset() if fboResetQuirk becomes true and 1st time in ClassLoader
    -> Only dumps if DEBUG
---
 src/jogl/classes/com/jogamp/opengl/FBObject.java   |  6 ++--
 .../classes/jogamp/opengl/GLFBODrawableImpl.java   | 35 ++++++++++++----------
 2 files changed, 23 insertions(+), 18 deletions(-)

(limited to 'src/jogl')

diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java
index 17589aa0e..7d0fcfa38 100644
--- a/src/jogl/classes/com/jogamp/opengl/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java
@@ -1088,8 +1088,10 @@ public class FBObject {
                 
             case 0:                
             default:
-                System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) + 
-                        " : " + getStatusString(vStatus));
+                if(DEBUG) {
+                    System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) + 
+                            " : " + getStatusString(vStatus));
+                }
                 return false;
         }
     }
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index b72f79868..86cfa4f4c 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -53,8 +53,11 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
     private int pendingFBOReset = -1;
     private boolean fboBound;
 
-    private static volatile boolean resetQuirkInfoDumped = false;
-    private static final int bufferCount = 2; // number of FBOs for double buffering. TODO: Possible to configure!
+    /** dump fboResetQuirk info only once pre ClassLoader and only in DEBUG mode */
+    private static volatile boolean resetQuirkInfoDumped = false; 
+    
+    /** number of FBOs for double buffering. TODO: Possible to configure! */
+    private static final int bufferCount = 2; 
     
     // private DoubleBufferMode doubleBufferMode; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
     
@@ -166,23 +169,23 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
                 }
                 return;
             } catch (GLException e) {
+                fboResetQuirk = true;
                 if(DEBUG) {
-                    e.printStackTrace();
-                }
-                if(!resetQuirkInfoDumped) { // dump info only once
-                    resetQuirkInfoDumped = true;
-                    System.err.println("GLFBODrawable: FBO Reset failed: "+e.getMessage());
-                    System.err.println("GLFBODrawable: Enabling FBOResetQuirk, due to GL driver bug.");
-                    final JoglVersion joglVersion = JoglVersion.getInstance();
-                    if(DEBUG) {
-                        System.err.println(VersionUtil.getPlatformInfo());
-                        System.err.println(joglVersion.toString());
-                        System.err.println(JoglVersion.getGLInfo(gl, null));
-                    } else {
-                        System.err.println(joglVersion.getBriefOSGLBuildInfo(gl, null));                        
+                    if(!resetQuirkInfoDumped) {
+                        resetQuirkInfoDumped = true;
+                        System.err.println("GLFBODrawable: FBO Reset failed: "+e.getMessage());
+                        System.err.println("GLFBODrawable: Enabling FBOResetQuirk, due to GL driver bug.");
+                        final JoglVersion joglVersion = JoglVersion.getInstance();
+                        if(DEBUG) {
+                            System.err.println(VersionUtil.getPlatformInfo());
+                            System.err.println(joglVersion.toString());
+                            System.err.println(JoglVersion.getGLInfo(gl, null));
+                        } else {
+                            System.err.println(joglVersion.getBriefOSGLBuildInfo(gl, null));                        
+                        }
+                        e.printStackTrace();
                     }
                 }
-                fboResetQuirk = true;
                 // 'fallthrough' intended
             }
         }
-- 
cgit v1.2.3