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