#version 320 es

precision mediump float;
in vec2 v_texcoord; // Use 'in' instead of 'varying'
uniform sampler2D tex;

out vec4 fragColor; // Use 'out' instead of 'gl_FragColor'

void main() {
  vec4 this_colour = texture(tex, v_texcoord); 
  float new_colour = (this_colour.r + this_colour.g + this_colour.b) / 3.0;
  fragColor = vec4(new_colour, new_colour, new_colour, 0.0);
}

