I'm trying to pass an array to a fragment shader:
//c++ code
float filter[9] = {-1.0f,-1.0f,-1.0f, -1.0f,9.0f,-1.0f, -1.0f,-1.0f,-1.0f};
glUniform1fv(glGetUniformLocation(imageShaderId, "filter"), 9, filter);
//inside fragment shader code
uniform float filter[9]; //global
if(filter[0]==-1.0) gl_FragColor = red;//in main()
This doesnt work for me.. I've looked at many examples and all seem to point to my code being correct? i can pass a single variable float without issues using glUniform1f, but not the array. Can somebody point me in the right direction?