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.
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");
}
}