2D Filter glitch

Here’s the filter code. I’m not gonna post the .blend, because I’ts my personal project…
It somulates a old CRT TV, but the problem is in the screen curvature ( vec2 crt(vec2 coord, float blend); ).
The “empty” areas are glitchy as you can see in the image.

This is what is expected (please note the black areas that BGE don’t leave black):



uniform sampler2D bgl_RenderedTexture;
uniform float time;
uniform float power;
uniform bool crt_on;


vec2 crt(vec2 coord, float bend)
{
    // put in symmetrical coords
    coord = (coord - 0.5) * 2.0;


    coord *= 1.1;    


    // deform coords
    coord.x *= 1.0 + pow((abs(coord.y) / bend), 2.0);
    coord.y *= 1.0 + pow((abs(coord.x) / bend), 2.0);


    // transform back to 0.0 - 1.0 space
    coord  = (coord / 2.0) + 0.5;


    return coord;
}


vec3 Gamma(vec3 value, float param)
{
    return vec3(pow(abs(value.r), param),pow(abs(value.g), param),pow(abs(value.b), param));
}


void main()
{ 
    vec2 texcoord = vec2(gl_TexCoord[0].xy);
    
    if (crt_on)
        texcoord = crt(texcoord, power);
        
    vec4 col = texture2D(bgl_RenderedTexture, texcoord);
    
    vec2 uv = 0.5 + (texcoord-0.5) * (0.9 + 0.01*sin(0.5*time));
    
    if (crt_on)
    {
        col = clamp(col*0.5+0.5*col*col*1.2,0.0,1.0);
        col *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y);
        col *= vec4(0.7,1.0,0.7,1);
        col *= 0.9+0.1*sin(10.0*time+uv.y*1000.0);
        col *= 0.97+0.03*sin(110.0*time);
        
        gl_FragColor = col+(col*0.6);
    }
    else
    {
        gl_FragColor = col;
    }
    
    float feather = 1.2;
    float innersize = 0.4;
    
    vec3 vig = vec3(1);
    float dist = distance(gl_TexCoord[0].xy, vec2(0.5, 0.5));
    vig *= smoothstep(feather, innersize, dist);
    
    gl_FragColor *= vec4(vig, 1.0);
    gl_FragColor *= vec4(vig, 1.0);
    //gl_FragColor *= vec4(vig, 1.0);


    gl_FragColor = vec4(Gamma(gl_FragColor.rgb, 1.2), 1.0);


}