Ok,
Then I might have scr*wed up somewhere .. here's the fragment shader ( perhaps u / v / offset need to be part of main .. or bloom set to vec4(0.0) ).
Code: Select all
uniform sampler2D tex1;
uniform float canvasWidth;
uniform float canvasHeight;
const float kernel[9] = {1.0/12.0,1.5/12.0,1.0/12.0,
1.5/12.0,2.0/12.0,1.5/12.0,
1.0/12.0,1.5/12.0,1.0/12.0};
float u = 16.0/canvasWidth;
float v = 16.0/canvasHeight;
vec2 offset[9] = {vec2(-u, v),vec2(0.0, v),vec2(u, v),
vec2(-u,0.0),vec2(0.0,0.0),vec2(u,0.0),
vec2(-u, -v),vec2(0.0, -v),vec2(u, -v)};
void main()
{
vec4 bloom;
for(int i=0; i<9; ++i)
{
bloom += texture2D(tex1, gl_TexCoord[0].xy+offset[i],4.0)*kernel[i];
}
gl_FragColor = texture2D(tex1, gl_TexCoord[0].xy)+bloom*4.0;
}
K