Skip to content

Instantly share code, notes, and snippets.

@VLZH
Last active August 10, 2020 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VLZH/7300bfdf477419912f64bf977952f379 to your computer and use it in GitHub Desktop.
Save VLZH/7300bfdf477419912f64bf977952f379 to your computer and use it in GitHub Desktop.
Играюсь с Webgl и читаю книгу https://thebookofshaders.com
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
void main() {
vec2 st = gl_FragCoord.xy/u_resolution;
vec2 mt = u_mouse/u_resolution;
float yd = abs(mt.y - st.y);
float xd = abs(mt.x - st.x);
float t = 0.0;
if (yd < 0.002 || xd < 0.002){
t = 1.0;
}
gl_FragColor = vec4(sin(u_time / 3.),sin(u_time / 5.),sin(u_time / 4.), t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment