I was wondering if there is a way to find out if the vertex attribute is enabled from the vertex shader? I know that if the vertex attribute is disabled, all values ββwill be treated as 0.0, so I could run the test as follows:
if (attribute == 0) { // Do something different to normal. } else { // Use the attribute. }
But this has an obvious problem for the case when the attribute is enabled and the value is simply set to 0 (it will be processed as if it were disabled)!
Another solution would be to simply use a single variable that states whether or not to use this attribute, but I wondered if there was something built into GLSL that would do this?
source share