LWJGLShaderObjectsState checkAttributeSizeLimits

I'm trying to apply a floatbuffer of tangents to a shader using the below code:



...
shader.setAttributePointer("tangent", 3, true, 0, tangentMesh.getTangents());
...



And I am receiving the warning below:

04-Nov-2007 17:29:07 com.jme.scene.state.lwjgl.LWJGLShaderObjectsState checkAttributeSizeLimits
WARNING: User defined attributes might overwrite default OpenGL attributes

So I checked the function which does the following:


public void checkAttributeSizeLimits() {
    if (shaderAttributes.size() > maxVertexAttribs) {
            logger.severe("Too many shader attributes(standard+defined): "
                            + shaderAttributes.size() + " maximum: "
                            + maxVertexAttribs);
    } else if (shaderAttributes.size() + 16 > maxVertexAttribs) {
            logger.warning("User defined attributes might overwrite default OpenGL attributes");
    }
}



I then inserted the below line, which outputted: SHADER SIZE: 16


System.out.println("SHADER SIZE: "+maxVertexAttribs);



And shaderAttributes.size() equalled 1. So my question is, am I always going to receive warnings when using attributes?

If you have nVidia card with 16 vertex attributes, then you are overwriting texture coordinate 8. So the warning is in place. You would not get the warning if your card had more than 16 vertex attributes. Its better to issue a warning, then to wonder how textures coords, normals or even vertices got overwritten by shader attributes. With 16 attributes, and a single texture coordinate per vertex, you can safely use 7 shader attributes.

I suppose thats alright. I'll be using three texture units - pleanty to go around  :slight_smile: