/ Published in: C

This, in the .frag shader will produce a screen-space checkboard.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
vec2 pos = mod(gl_FragCoord.xy,vec2(100)); if ((pos.x > 50.0)&&(pos.y > 50.0)){ gl_FragColor=vec4(1.0, 1.0, 1.0, 1.0); } if ((pos.x < 50.0)&&(pos.y < 50.0)){ gl_FragColor=vec4(1.0, 1.0, 1.0, 1.0); } if ((pos.x < 50.0)&&(pos.y > 50.0)){ gl_FragColor=vec4(0.0, 0.0, 0.0, 1.0); } if ((pos.x > 50.0)&&(pos.y < 50.0)){ gl_FragColor=vec4(0.0, 0.0, 0.0, 1.0); }
Comments
