https://bugs.freedesktop.org/show_bug.cgi?id=31499
--- Comment #7 from Tom Stellard tstellar@gmail.com 2010-11-20 11:35:49 PST --- Actually calculating the offset values inside the shader would be even better. So something like this:
uniform sampler2D texUnit; uniform vec4 kernel[25]; uniform int direction; uniform int count; uniform float width;
void main(void) { vec4 sum = texture2D(texUnit, gl_TexCoord[0].st) * kernel[0]; for (int i = 1; i < 25; i++) { vec2 offset = (direction == 0 ? vec2(i / width, 0.0) : vec2(0.0, i / width); offset = (i < count) ? offset : vec2(0.0, 0.0); sum += texture2D(texUnit, gl_TexCoord[0].st - offset) * kernel[i]; sum += texture2D(texUnit, gl_TexCoord[0].st + offset) * kernel[i]; } gl_FragColor = sum; }