I want to shadow the ATV with checkers:
F (P) = [sex (Px) + gender (Py)] mod 2.
My quad:
glBegin(GL_QUADS); glVertex3f(0,0,0.0); glVertex3f(4,0,0.0); glVertex3f(4,4,0.0); glVertex3f(0,4, 0.0); glEnd();
Vertex Shader File:
varying float factor; float x,y; void main(){ x=floor(gl_Position.x); y=floor(gl_Position.y); factor = mod((x+y),2.0); }
And the fragment shader file:
varying float factor; void main(){ gl_FragColor = vec4(factor,factor,factor,1.0); }
But I get this:

It seems the mod doe function is not working, or maybe something else ... Any help?
source share