Hey all.
I’m currently trying to upload an array of mat4 to a GLSL shader problem. I’m however having quiet a bit of difficulty finding out what I’m doing wrong (If it’s not a driver bug).
Silly test GLSL code:
// Attributes
in vec4 m_kColor;
out vec4 FRAGDATA0;
uniform mat4 akTest[4];
// Shader code
void main()
{
vec4 kTest = m_kColor;
for (int i = 0; i < 4; i++)
{
kTest = akTest[i] * kTest;
}
FRAGDATA0 = kTest;
}
Silly test CPU program:
int loc0 = pkTest->GetUniformLocation("akTest[0]"); // <-- Returns 0
int loc1 = pkTest->GetUniformLocation("akTest[1]"); // <-- Returns 1 (Should be 4)
int loc2 = pkTest->GetUniformLocation("akTest[2]"); // <-- Returns 2 (Should be 8)
int loc3 = pkTest->GetUniformLocation("akTest[3]"); // <-- Returns 3 (Should be 12)
As you can see from the above test code I’m not getting the matrix locations I would expect. Afaik a matrix in a GLSL shader takes up 4 128bit registers. When trying to upload the matrices using glUniformMatrix4fv(m_iLocation, 4, GL_FALSE, akMatrices);