I have a fragment shader that does something like this:
#ifdef GL_ES
precision lowp float;
#endif
varying vec2 v_texCoord;
uniform sampler2D u_texture;
uniform float u_time;
void main(void)
{
//sample the color
vec4 sampledcolor = texture2D(u_texture, v_texCoord);
//convert to hsv
vec3 color = ConvertRGBToHSV(sampledcolor.rgb);
//hue modification
color.r = mod((color.r + (u_time * 0.1)), 1.0);
//convert back to rgb
color = ConvertHSVToRGB(color);
//set the final color
gl_FragColor = vec4(color.r,color.g,color.b,sampledcolor.a);
}
Where the functions ConvertRGBtoHSV and ConvertHSVToRGB do the proper color conversions. When the shader is applied in the iPhone simulator the hue cycle is correct. When the shader is applied on the actual iPhone4 device, the color doesn’t appear to cycle the same and also doesn’t continue after the first cycle. It almost seems as if the mod() isn’t happening on the device.
Anyone have any ideas what could be going wrong here?
platform: iOS
XCode version: 4.3.1
target: iphone4
cocos2d-x: cocos2d-2.0-rc2-x-2.0.1