color.frag 520 B

1234567891011121314151617181920212223
  1. // Applies animated over time gradient to the user texture.
  2. #version 330
  3. precision mediump float;
  4. uniform vec2 resolution;
  5. in vec4 color;
  6. in vec2 seed;
  7. out vec4 out_color;
  8. #define SEED_MARKER_RADIUS 5
  9. #define SEED_MARKER_COLOR vec4(.1, .1, .1, 1)
  10. void main(void) {
  11. if (length(gl_FragCoord.xy - seed) < SEED_MARKER_RADIUS) {
  12. gl_FragDepth = 0;
  13. out_color = SEED_MARKER_COLOR;
  14. } else {
  15. gl_FragDepth = length(gl_FragCoord.xy - seed)/length(resolution);
  16. out_color = color;
  17. }
  18. }