Hi all, does anyone know if GLSL 1.1 supports non constant array indexes?
I am storing the bone indices in the secondary color channel as single bytes. After accessing them after they have been expanded to floats in the shader requires a cast, which removes the constness of the indices,
example:
// this is what i wanted to have happen
bonepose.x = pos = dot(bones[gl_SecondaryColor.x + 0], gl_Vertex);
bonepose.y = pos = dot(bones[gl_SecondaryColor.x + 1], gl_Vertex);
bonepose.z = pos = dot(bones[gl_SecondaryColor.x + 2], gl_Vertex);
// this is with the cast to integers that i mentioned
bonepose.x = pos = dot(bones[int(gl_SecondaryColor.x) + 0], gl_Vertex);
bonepose.y = pos = dot(bones[int(gl_SecondaryColor.x) + 1], gl_Vertex);
bonepose.z = pos = dot(bones[int(gl_SecondaryColor.x) + 2], gl_Vertex);
it may also be important to mention that glsl seems to require the explicit casting. Does anyone have any opinions of how to do this properly in glsl 1.1? It doesn’t seem I’m on the right path, thanks!