uniform sampler2D Color0; // the texture with the scene you want to blur

/*
//const float blurSize = 1.0/512.0; // I've chosen this size because this will result in that every step will be one pixel wide if the RTScene texture is of size 512x512
 
void main(void)
{
   vec4 sum = vec4(0.0);
 
   // blur in y (vertical)
   // take nine samples, with the distance blurSize between them
   //sum += texture2D(Color0, vec2(gl_TexCoord[0].s - 4.0*blurSize, gl_TexCoord[0].t)) * 0.054670;
   sum += texture2D(Color0, gl_TexCoord[1].st ) * 0.015625; //0.004432;
   sum += texture2D(Color0, gl_TexCoord[2].st ) * 0.09375;  //0.053991;
   sum += texture2D(Color0, gl_TexCoord[3].st ) * 0.234375; //0.241971;
   sum += texture2D(Color0, gl_TexCoord[0].st ) * 0.3125;   //0.398942;
   sum += texture2D(Color0, gl_TexCoord[4].st ) * 0.234375; //0.241971;
   sum += texture2D(Color0, gl_TexCoord[5].st ) * 0.09375;  //0.053991;
   sum += texture2D(Color0, gl_TexCoord[6].st ) * 0.015625; //0.004432;
   //sum += texture2D(Color0, vec2(gl_TexCoord[0].s + 4.0*blurSize, gl_TexCoord[0].t)) * 0.054670;
 
   gl_FragColor = sum;//1.00027 * sum;
}
*/

// gaussian blur by importance sampling, see shaderX7, p.262
void main(void)
{
  gl_FragColor = 0.2 * ( texture2D(Color0, gl_TexCoord[0].st) +
                         texture2D(Color0, gl_TexCoord[1].st) +
                         texture2D(Color0, gl_TexCoord[2].st) +
                         texture2D(Color0, gl_TexCoord[3].st) +
                         texture2D(Color0, gl_TexCoord[4].st) );
}
