I was wondering if there was a way to tell if a vertex attribute is enabled from within a vertex shader? I know that if the vertex attribute is disabled all the values will be treated as 0.0, so I could do a test like the following:
if (attribute == 0)
{
// Do something different to normal.
}
else
{
// Use the attribute.
}
But this has the obvious problem for the case that the attribute is enabled and the value is just set to 0 (it will be treated as if it's disabled)!
The other solution would be to just use a uniform variable that states whether or not to use the attribute, but I wondered if there was anything built into GLSL that would do that?