Advertisement
Guest User

Untitled

a guest
Apr 10th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #version 330
  2.  
  3. in vec2 texCoord0;
  4.  
  5. uniform sampler2D texture0;
  6. uniform vec2 resolution = vec2(800, 600); // static to reduce uniform calls
  7. uniform bool horizontal;
  8. uniform int samples;
  9.  
  10. out vec4 outColor;
  11.  
  12.  
  13. void main(void)
  14. {
  15. vec3 colorSum = vec3(0, 0, 0);
  16. int iterations = 0;
  17.  
  18. if (horizontal)
  19. {
  20. for (int i = -samples; i <= samples; i++)
  21. {
  22. colorSum += texture(texture0, texCoord0 + vec2(i, 0.0) / resolution).rgb;
  23. iterations++;
  24. }
  25. }
  26. else
  27. {
  28. for (int i = -samples; i <= samples; i++)
  29. {
  30. colorSum += texture(texture0, texCoord0 + vec2(0.0, i) / resolution).rgb;
  31. iterations++;
  32. }
  33. }
  34. outColor = vec4(colorSum / iterations, 1);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement