Fragment shader causes serious lag when I run it on iPhone 4. I tried to comment part of calculations, however still there are some jitters even though I barely am doing any calculation in the Fragment Shader.
// Fragment Shader Code
uniform sampler2D texture;
varying lowp vec2 fragmentTexCoords;
uniform lowp float passAlpha;
uniform lowp vec2 inPosition;
uniform lowp float varUniform;
void main()
{
gl_FragColor = texture2D(texture, fragmentTexCoords);
lowp float disY = gl_FragCoord.y - inPosition.y;
lowp float disMax = 250.0;
lowp float coeff = 1.0 - varUniform;
gl_FragColor.rgb *= coeff;
}
//My render function is:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glFlush();
I am still not sure what could be the problem, I am sure iPhone can handle way more complex calculations ... Any ideas ?
Thanks in advance.