Reputation: 64266
I'm writing graphic shader program. I wrote everything I need except the color changing. In cycle there is passing some counter variable to the shader and I have to change it's color from white to orange shade. What I have change to achive this?
Upvotes: 1
Views: 262
Reputation: 72241
I'm not sure I've got you right, but my guess is you need something like this:
uniform float counter; // assumed range 0 .. 1
const vec3 WHITE = vec3(1,1,1);
const vec3 ORANGE = vec3(1,0.6,0.2);
void main() {
vec3 mixedColor = mix(WHITE,ORANGE,counter);
// will be white for counter < 0,
// orange for counter > 1,
// shaded in between
}
Upvotes: 2