I'm trying to modify the fragment shader which is part of the standard iPhone/XCode OpenGL ES template. I want to make it so that every other row of pixels is transparent. I have this code so far:
varying lowp vec4 colorVarying;
void main()
{
gl_FragColor = vec4(colorVarying.x, colorVarying.y, colorVarying.z, floor(mod(gl_FragCoord.y, 2.0)));
}
But when I compile and run I still get the same square moving up and down with no other effects.
Here is my vertex shader (my keyboard just broke so no return key! DOH!)
attribute vec4 position;
attribute vec4 color;
varying vec4 colorVarying;
uniform float translate;
void main()
{
gl_Position = position;
gl_Position.y += sin(translate) / 2.0;
colorVarying = color;
}
Using this vertex shader and fragment shader above, I get no 'scanline effect' which I was hoping for. I'm testing using the iPad simulator and also the 3.1.3 iPhone simulator.
What am I doing wrong here? I'm a complete n00b at Glsl - I'm trying to teach myself the very basics (starting with this tutorial) .