今日永杰开金
float size = 100.;
vec2 checkerboard = mod(floor(gl_FragCoord.xy / size), 2.);
float c = mod(checkerboard.x + checkerboard.y, 2.);
gl_FragColor = vec4(vec3(c), 1);
或
vec2 uv = floor(S * p.xy * vec2(iResolution.x / iResolution.y, 1) / iResolution.xy);
c = vec4(vec3(mod(uv.x + uv.y, 2.)), 1);
或
float size = 100.;
float oddX = mod(floor(gl_FragCoord.x / size), 2.);
float oddY = mod(floor(gl_FragCoord.y / size), 2.);
float c = 0.;
if( oddX == oddY ){
c = 1.;
}
gl_FragColor = vec4(vec3(c), 1);