Home > other >  Cocos2d - x use shader implement color offset problem
Cocos2d - x use shader implement color offset problem

Time:09-25

Project requirements images need to be able to change color, debugging and flash senior panel out of the same effect, is the default setColor Multiplier, offset is not supported, wrote a myself, but I don't know where is wrong, ask tall person

Varying vec4 v_fragmentColor;
Varying vec2 v_texCoord;

Uniform vec4 u_colorOffset

Void main ()
{
//gl_FragColor=v_fragmentColor * texture2D (CC_Texture0, v_texCoord);
Vec4 color=v_fragmentColor * texture2D (CC_Texture0 v_texCoord);
Gl_FragColor=vec4 (color) RGB + u_colorOffset) RGB * color in a color, a);
}

The writing above is correct in most cases, but in the case of some white with transparent gradient is wrong, xiaodi bucai, also hope you give advice or comments
  • Related