sajjad
#1
Hello forum,
I have a OF type variable declared and defined as follows:
rim_color = ofFloatColor(0.3f,0.3f,0.3f,1.0f);
Then i want to send the value to the shader as uniform. Should it be sent as array ?
I am not sure to use setUniform1fv(…) or not.
Any hint ?
Thanks
Ahbee
#2
you use ofvec4f;
rim_color = ofVec4f(.3,.3,.3,1.0);
shader.setUniform4fv("rim_color",&rim_color,1);
Just get to know how the built-in uniform types can be used.
In the oF app:
rim_color = ofFloatColor(0.3f,0.3f,0.3f,1.0f);
shader.setUniform4f("rim_color", rim_color.r, rim_color.g, rim_color.b, rim_color.a);
then in the shader code have:
uniform vec4 rim_color;
You can address a vec4
in the fragment shader with .r .g .b .a
as well as .x .y .z
and .w
.
vec3 just_rgb = rim_color.rgb;
float alpha = rim_color.a;
2 Likes