Basic OpenGL ES2 (iPhone Simulator) question...

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-06-03T12:38:00Z Indexed on 2010/06/03 19:24 UTC
Read the original article Hit count: 519

Filed under:
|
|

Hi!

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.

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 - http://www.mobileorchard.com/getting-started-with-opengl-es-20-on-the-iphone-3gs/)

Please help! Thanks! David :)

© Stack Overflow or respective owner

Related posts about iphone

Related posts about opengl-es