// Overscan shader (helps to get rid of black bars by enlarging the image)

// edit theese values to get the overscan you want (set a negative value for shrinking)

#define OverscanX 0.00              // relative x-overscan setting
#define OverscanY 0.09              // relative y-overscan setting


uniform vec4 OGL2Size;
uniform vec4 OGL2Param;
uniform vec4 OGL2InvSize;


vec2 Overscan(vec2 pos){
  pos=pos*2.0-1.0;    
  pos*=vec2(1.0-OverscanX,1.0-OverscanY);
  return pos*0.5+0.5;}

void main()
{
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
	gl_TexCoord[0] = gl_MultiTexCoord0;

	vec2 texcoord = vec2(gl_MultiTexCoord1.x,1.0-gl_MultiTexCoord1.y);
	vec2 pos=Overscan(texcoord)*OGL2Size.zw;
	vec2 diff = pos - texcoord*OGL2Size.zw;

	gl_TexCoord[0].xy = gl_TexCoord[0].xy + diff;

}