Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 330
- in vec2 texCoord0;
- uniform sampler2D texture0;
- uniform vec2 resolution = vec2(800, 600); // static to reduce uniform calls
- uniform bool horizontal;
- uniform int samples;
- out vec4 outColor;
- void main(void)
- {
- vec3 colorSum = vec3(0, 0, 0);
- int iterations = 0;
- if (horizontal)
- {
- for (int i = -samples; i <= samples; i++)
- {
- colorSum += texture(texture0, texCoord0 + vec2(i, 0.0) / resolution).rgb;
- iterations++;
- }
- }
- else
- {
- for (int i = -samples; i <= samples; i++)
- {
- colorSum += texture(texture0, texCoord0 + vec2(0.0, i) / resolution).rgb;
- iterations++;
- }
- }
- outColor = vec4(colorSum / iterations, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement