#version 430 core in VS_OUT { vec4 Texture; } fs_in; layout (location = 0) out vec4 Color; layout (rg16i, binding = 0) readonly uniform iimageBuffer Image; vec2 get_sample(int coordinate) { ivec2 v = imageLoad(Image, coordinate).xy; return vec2(float(v.x), float(v.y)) * (1.0 / 32768.0); } void main() { vec2 v = get_sample(int(gl_FragCoord.x)); float y = -(fs_in.Texture.y * 2 - 1); float c; if (y > 0) { c = float(y < v.x); } else { c = float(y > v.y); } Color = vec4(c, 0, 0, 1); }