i’m trying to convert the rgb to YCbCr for better color manipulation, but i can’t seem to figure it out.
const float Kr = 0.299;
const float Kg = 0.587;
const float Kb = 0.114;
void main()
{
lowp vec4 tex = texture2D(texture_sampler, var_texcoord0.xy);
vec4 tempfrag = tex * var_color;
vec3 newcol=RGBtoYCBCR( vec3(tempfrag.x,tempfrag.y,tempfrag.z) );
}
vec3 RGBtoYCBCR(vec3 rgbcolor)
{
float y=0.0;
float Cb=0.0;
float Cr=0.0;
float r=rgbcolor.x;
float g=rgbcolor.y;
float b=rgbcolor.z;
y=r*Kr+g*Kg+b*Kb;
Cb=-0.5*(Kr/(1.0-Kb))*r -0.5*(Kg/(1.0-Kb))*g + 0.5*b ;
Cr=0.5*r -0.5*(Kg/(1.0-Kr))*g -0.5*(Kb/(1.0-Kr))*b; ;
return vec3(y,Cb,Cr);
}
it just spits some errors out, and i don’t really get why. i don’t see anywhere in my code that i’m converting a const float to a vec3.
Compatability issue: _generated_1951c3df.fpc2333632367242982588.glsl: "precision mediump int; precision highp float;"
_generated_1951c3df.fpc2333632367242982588.glsl:25: error: 'RGBtoYCBCR' : no matching overloaded function found
_generated_1951c3df.fpc2333632367242982588.glsl:25: error: '=' : cannot convert from ' const float' to ' temp highp 3-component vector of float'