1#version 140 2 3#extension GL_ARB_fragment_coord_conventions: require 4#extension GL_ARB_explicit_attrib_location : enable 5 6#ifdef GL_ES 7precision mediump float; 8#endif 9 10in vec4 i; 11 12layout (origin_upper_left,pixel_center_integer) in vec4 gl_FragCoord; 13layout (location = 0) out vec4 myColor; 14 15const float eps=0.001; 16 17void main() 18{ 19 myColor = vec4(0.2); 20 if (gl_FragCoord.y >= 10) { 21 myColor.b = 0.8; 22 } 23 if (gl_FragCoord.y == trunc(gl_FragCoord.y)) { 24 myColor.g = 0.8; 25 } 26 if (gl_FragCoord.x == trunc(gl_FragCoord.x)) { 27 myColor.r = 0.8; 28 } 29 30 vec4 diff = gl_FragCoord - i; 31 if (abs(diff.z)>eps) 32 myColor.b = 0.5; 33 if (abs(diff.w)>eps) 34 myColor.a = 0.5; 35 36}