How to pass an ofColor array to a glsl shader uniform?


I have the following array ofColor colors[5]; that I need to pass to a glsl shader, I set a uniforma variable in the vert shader like this uniform vec4 colors[5]; and I am setting the shader like this colorShader.setUniform4fv( “colors”, colors ); but I get the following error no matching function for call to 'ofShader::setUniform4fv(const char [7], ofColor [5])'

Any ideas how can I fix this?


  • rS

try with:

colorShader.setUniform4fv( "colors", (float*)colors );  

Thanks! Also the answer I was looking for.