Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Author: Jeremy Rotsztain
- // Course: ShaderArt (DIGF-3011, Winter 2022)
- // Title: Hello World (GLSL)
- // Edited by: Amanda Huynh Feb 16 2022
- // ignore this for the time being
- #ifdef GL_ES
- precision mediump float;
- #endif
- uniform vec2 u_resolution;
- uniform vec2 u_mouse;
- uniform float u_time;
- void main() {
- // get the xy coordinate in pixels & normalize to [0, 1] range
- // by dividing by width (500 x 500 px)
- vec2 st = gl_FragCoord.xy/u_resolution.xy;
- // position in a bit higher than center
- // https://thebookofshaders.com/07/
- float pct = 0.0;
- pct = distance(st,vec2(0.500,0.700));
- // fix for aspect ratio
- st.x *= u_resolution.x/u_resolution.y;
- vec3 color = vec3(pct);
- // red as sinusodal curve positioned pct
- color.r = sin(u_time-pct* 1.5)*3.128;
- // // center blue, mouse interaction
- color.b = sin(u_mouse.x/u_resolution.x+pct);
- // // green as fract
- color.g = fract(u_time-pct *15.*-st.y);
- // RGBA
- gl_FragColor = vec4(color,1.);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement