1 #ifdef GL_ES 2 precision lowp float; 3 #endif 4 5 uniform float u_filter[9]; 6 uniform vec2 u_offsets[9]; 7 8 uniform sampler2D u_texture; 9 10 varying vec4 v_color; 11 varying vec2 v_texCoords; 12 13 void main() { 14 vec4 sum = vec4(0.0); 15 vec4 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[0]); 16 sum += tmp * u_filter[0]; 17 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[1]); 18 sum += tmp * u_filter[1]; 19 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[2]); 20 sum += tmp * u_filter[2]; 21 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[3]); 22 sum += tmp * u_filter[3]; 23 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[4]); 24 sum += tmp * u_filter[4]; 25 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[5]); 26 sum += tmp * u_filter[5]; 27 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[6]); 28 sum += tmp * u_filter[6]; 29 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[7]); 30 sum += tmp * u_filter[7]; 31 tmp = texture2D(u_texture, v_texCoords.st + u_offsets[8]); 32 sum += tmp * u_filter[8]; 33 34 gl_FragColor = sum; 35 }