Welcome, Guest. Please login or register.
Did you miss your activation email?
July 31, 2010, 11:42:01 am
advanced search




Pages: [1]
  Print  
Author Topic: [Committed] "Shader attributes may override ... " warning flood patch  (Read 442 times)
dhdd
Committer
Sr. Member
*
Offline Offline

Posts: 857


so long ...


View Profile
« on: November 18, 2009, 04:14:56 pm »

hey guys.

this very simple patch puts a stop to the endless flood of WARNINGS when you pass Attributes to shaders and they may override other shader attributes. instead the warning is issued only once per GLSLShaderObjectState.

Code:
Index: src/com/jme/scene/state/jogl/JOGLShaderObjectsState.java
===================================================================
--- src/com/jme/scene/state/jogl/JOGLShaderObjectsState.java (revision 4737)
+++ src/com/jme/scene/state/jogl/JOGLShaderObjectsState.java (working copy)
@@ -73,6 +73,8 @@
     /** OpenGL id for the attached fragment shader. */
     private int fragmentShaderID = -1;
 
+    private boolean alreadyWarned = false;
+
     /** Holds the maximum number of vertex attributes available. */
     private static int maxVertexAttribs;
 
@@ -378,7 +380,8 @@
             logger.severe("Too many shader attributes(standard+defined): "
                             + shaderAttributes.size() + " maximum: "
                             + maxVertexAttribs);
-        } else if (shaderAttributes.size() + 16 > maxVertexAttribs) {
+        } else if (!alreadyWarned && shaderAttributes.size() + 16 > maxVertexAttribs) {
+            alreadyWarned = true;
             logger.warning("User defined attributes might overwrite default OpenGL attributes");
         }
     }
Index: src/com/jme/scene/state/lwjgl/LWJGLShaderObjectsState.java
===================================================================
--- src/com/jme/scene/state/lwjgl/LWJGLShaderObjectsState.java (revision 4737)
+++ src/com/jme/scene/state/lwjgl/LWJGLShaderObjectsState.java (working copy)
@@ -74,6 +74,8 @@
 
     /** OpenGL id for the attached fragment shader. */
     private int fragmentShaderID = -1;
+
+    private boolean alreadyWarned = false;
    
     /** Holds the maximum number of vertex attributes available. */
     private static int maxVertexAttribs;
@@ -373,7 +375,8 @@
             logger.severe("Too many shader attributes(standard+defined): "
                             + shaderAttributes.size() + " maximum: "
                             + maxVertexAttribs);
-        } else if (shaderAttributes.size() + 16 > maxVertexAttribs) {
+        } else if (!alreadyWarned && shaderAttributes.size() + 16 > maxVertexAttribs) {
+            alreadyWarned = true;
             logger.warning("User defined attributes might overwrite default OpenGL attributes");
         }
     }

« Last Edit: November 25, 2009, 09:29:24 am by dhdd » Logged

-------------------------------------------------------------------------------------------------------
All your BASE are belong to us!
Tags:
Pages: [1]
  Print  
 
Jump to: