Hello,
i have a strange problem to solve…
When i’m using a uniform mat4 array there seems to be a limitation around 70> and <80.
Everytime i add more than 80 mat4’s to my shader it gets dizzy of some kind. The requestet matrix is not accessable and instead every second another matrix returned. I assume a value overflow of some kind.
// I save the matrix within this array:
float texMatrix[16];
// This is how i load the matrix into the array
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glRotatef(0, 0.0, 0.0, 1.0);
glTranslatef(2, 0.1, 0.0);
glPushMatrix();
glGetFloatv(GL_TEXTURE_MATRIX, texMatrix);
//finnaly i use a loop to add nMatrixSize times the float array to a vector which is handled over to the glUniformMatrix4fv() method.
glUniformMatrix4fv(matrices_location, nMatrixSize, GL_FALSE, &vec[0]);
varying vec2 texCoord;
uniform mat4 texMatrix[70];
//This is my vertex shader. I defined a uniform mat4 array and access the values.
void main()
{
texCoord= (texMatrix[69] * gl_ModelViewMatrix * gl_Vertex).st;
gl_Position = ftransform();
}
Again if i use 70 matrices this works just fine.
I have no idea which limitation is used here… I read something about the GL_MAX_VERTEX_UNIFORM_COMPONENTS where each mat4 elemnent uses a vertex uniform component since it is also a float. But i can store upto 35658 floats. Which means 2228 mat4’s.
Perhaps someone of you has an idea why there is a limitation or a workaround how i can access more than 70 mat4’s within my shader. I read something about a buffer object…? any clue?
Thank you
Greetings,
Jotschi
PS: I can provide an example program which shows the issue more clearly if needed.