3 * @brief convolve3 fragment shader.
7 /** After glsl1110 this need to be explicitly declared; used by fixed functionality at the end of the OpenGL pipeline.*/
11uniform sampler2D SAMPLER0;
12uniform float COEFFICIENTS[3];
13uniform vec2 OFFSETS[3];
16 * @brief Fragment shader that convolves a 3 element filter with the specified texture.
18 * Orientation of the filter is controlled by "OFFSETS".
19 * The filter itself is specified by "COEFFICIENTS".
22 vec2 inColor = gl_TexCoord[0].st;
23 vec4 outColor = vec4(0, 0, 0, 1);
25 outColor += COEFFICIENTS[0] * texture2D(SAMPLER0, inColor + OFFSETS[0]);
26 outColor += COEFFICIENTS[1] * texture2D(SAMPLER0, inColor + OFFSETS[1]);
27 outColor += COEFFICIENTS[2] * texture2D(SAMPLER0, inColor + OFFSETS[2]);
29 gl_FragColor = outColor;