123456789101112131415161718192021222324252627
  1. #version 120
  2. uniform sampler2D texture;
  3. uniform vec2 screenSize;
  4. uniform float time;
  5. varying vec2 uvCoord;
  6. const float pi = 3.14159265f;
  7. vec3 color(float x) {
  8. return max(min(sin(vec3(x,x+pi*2.0/3.0,x+pi*4.0/3.0))+0.5,1.0),0.0);
  9. }
  10. void main() {
  11. vec2 pos = (( gl_FragCoord.xy / screenSize.xy )-0.5)*screenSize.xy/screenSize.x*4.0;
  12. pos+=normalize(pos);
  13. pos.xy+=sin(pos.yx*10.0)*0.1;
  14. float r=(2.0/(dot(pos,pos)*10.0+1.0));
  15. vec2 rr=vec2(cos(r),sin(r));
  16. pos=pos.xy*rr.xx+pos.yx*rr.yy*vec2(-1.0,1.0);
  17. float f=(length(pos)*10.0)+time;
  18. //f=acos((pos.x/length(pos)*0.5+0.5)*pi);
  19. f+=sin(atan(pos.y,pos.x)*7.0)*5.0;
  20. vec4 rect = texture2D(texture,uvCoord);
  21. gl_FragColor = vec4(color(f),1.f)*rect;
  22. }