#version 310 es precision mediump float; precision mediump int; layout(location = 0) uniform float count; layout(location = 0) in highp vec4 vertex; layout(location = 0) out vec4 fragColor; uniform mediump sampler2D tex; bool isSomething(float x) { return x < 0.0; } void main() { vec4 c; float x = textureLod(tex, vertex.xy, 0.0).x; if (isSomething(x)) { c = vec4(1,0,0,1); } else { c = vec4(0,1,0,1); } fragColor = c; }