
 
URL: http://glslsandbox.com/e#24946.2
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | // Simple Checkerboard Texture // By: Brandon Fogerty // bfogerty at gmail dot com // xdpixel.com #ifdef GL_ES precision mediump float; #endif uniform float time; uniform vec2 resolution; #define HorizontalTileScale     5.0 #define VerticalTileScale   5.0 void main( void )  {     // Convert uv from (0 to 1) to (-1 to 1)     vec2 uv = ( gl_FragCoord.xy / resolution.xy ) * 2.0 - 1.0;     // Account for Aspect Ratio so we get square tiles.     uv.x *= resolution.x / resolution.y;     // tileCoefficient will be toggled between 1 and 0 relative to the current pixel's uv coordinate.     float tileCoefficient = floor( mod( floor(uv.x * HorizontalTileScale) + floor(uv.y * VerticalTileScale), 2.0 ) );     vec3 finalColor = vec3( 1.0, 1.0, 1.0 ) * tileCoefficient;     gl_FragColor = vec4( finalColor, 1.0 ); } | 

