shaders

assortment of fragment shaders.
Log | Files | Refs | README | LICENSE

miyagi.frag (489B)


      1 #ifdef GL_ES
      2 precision mediump float;
      3 #endif
      4 
      5 uniform vec2 u_resolution;
      6 uniform vec2 u_mouse;
      7 uniform float u_time;
      8 
      9 // Plot a line on Y using a value between 0.0-1.0
     10 
     11 float plot(vec2 st) {
     12     return smoothstep(0.02, 0.0, abs(st.y - st.x));
     13 }
     14 
     15 void main() {
     16     vec2 st = gl_FragCoord.xy/u_resolution;
     17 
     18     float y = st.x;
     19 
     20     vec3 color = vec3(y);
     21 
     22     // Plot a line
     23     float pct = plot(st);
     24     color = (1.0-pct)*color+pct*vec3(0.0,1.0,0.0);
     25 
     26     gl_FragColor = vec4(color,1.0);
     27 }
     28