precision highp float;

uniform sampler2D inputImageTexture;
uniform float uBlurRadius;
uniform vec2 uTexelOffset;

varying vec2 textureCoordinate;

void main() {
    vec4 color = vec4(0.0);
    vec2 texCoord = textureCoordinate;
    float radius = uBlurRadius;

    color += texture2D(inputImageTexture, texCoord) * 0.227027;

    for (int i = 1; i < 5; i++) {
        float weight = 0.227027;
        if(i == 1){
            weight = 0.194595;
        }
        if(i == 2){
           weight = 0.121622;
        }
        if(i == 3){
            weight = 0.054054;
        }
        if(i == 4){
            weight = 0.016216;
        }
        vec2 offset = vec2(float(i) * uTexelOffset.x * radius, 0.0);
        color += texture2D(inputImageTexture, texCoord - offset) * weight;
        color += texture2D(inputImageTexture, texCoord + offset) * weight;
    }

    gl_FragColor = color;
}