Hello,
I am quite new to lwjgl3 and have a little issue. I am trying to load an array of vectors to my fragment shader but unfortunately only the first entry of the array receives input and i have no clue what I am doing wrong. Accessing other uniforms / attributes is working fine but i cant access arrays. The shader compiles and links without any errors.
This is my test shader:
#version 400 core
out vec4 out_Color;
uniform vec3 mycolors[4];
void main(void)
{
out_Color = vec4(mycolors[0], 1.0); /*works*/
/*out_Color = vec4(mycolors[1], 1.0); not working*/
/*out_Color = vec4(mycolors[2], 1.0); not working*/
/*out_Color = vec4(mycolors[3], 1.0); not working*/
}
I can only access mycolors[0] no other array values. I tried to access each location manually by glGetUniformLocation(program, mycolors); but all i get is the location for mycolors[0] ([1-3] return for location -1).
So i tried to load the uniform data with a floatbuffer to mycolors[0] but I get the same result only slot 0 has a value:
FloatBuffer floatBuffer = BufferUtils.createFloatBuffer(12);
floatBuffer.put(new float[]{1,0, 1, 1,0, 1, 1,0, 1, 1, 0, 1});
floatBuffer.flip(); /otherwise [0] has the wrong color*/
glUniform3(location, floatBuffer);
Could someone please give me a hint what i am doing wrong?