UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
convolve5_fs.glsl
Go to the documentation of this file.
1
/**
2
* @file
3
* @brief convolve5 fragment shader.
4
*/
5
6
#ifndef glsl110
7
/** After glsl1110 this need to be explicitly declared; used by fixed functionality at the end of the OpenGL pipeline.*/
8
out vec4 gl_FragColor;
9
#endif
10
11
uniform sampler2D SAMPLER0;
12
uniform float COEFFICIENTS[5];
13
uniform vec2 OFFSETS[5];
14
15
/**
16
* @brief Fragment shader that convolves a 5 element filter with the specified texture.
17
*
18
* Orientation of the filter is controlled by "OFFSETS".
19
* The filter itself is specified by "COEFFICIENTS".
20
*/
21
void main(void) {
22
vec2 inColor = gl_TexCoord[0].st;
23
vec4 outColor = vec4(0, 0, 0, 1);
24
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]);
28
outColor += COEFFICIENTS[3] * texture2D(SAMPLER0, inColor + OFFSETS[3]);
29
outColor += COEFFICIENTS[4] * texture2D(SAMPLER0, inColor + OFFSETS[4]);
30
31
gl_FragColor = outColor;
32
}
base
shaders
convolve5_fs.glsl
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0