-
Notifications
You must be signed in to change notification settings - Fork 3
/
untitled.glsl
42 lines (36 loc) · 1021 Bytes
/
untitled.glsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
#define PI_TWO 1.570796326794897
#define PI 3.141592653589793
#define TWO_PI 6.283185307179586
vec2 coord(in vec2 p) {
p = p / u_resolution.xy;
// correct aspect ratio
if (u_resolution.x > u_resolution.y) {
p.x *= u_resolution.x / u_resolution.y;
p.x += (u_resolution.y - u_resolution.x) / u_resolution.y / 2.0;
} else {
p.y *= u_resolution.y / u_resolution.x;
p.y += (u_resolution.x - u_resolution.y) / u_resolution.x / 2.0;
}
// centering
p -= 0.5;
p *= vec2(-1.0, 1.0);
return p;
}
#define rx 1.0 / min(u_resolution.x, u_resolution.y)
#define uv gl_FragCoord.xy / u_resolution.xy
#define st coord(gl_FragCoord.xy)
#define mx coord(u_mouse)
void main() {
vec3 color = vec3(
abs(cos(st.x + mx.x)),
abs(sin(st.y + mx.y)),
abs(sin(u_time))
);
gl_FragColor = vec4(color, 1.0)
}