-
Notifications
You must be signed in to change notification settings - Fork 0
/
tiled_display.glsl
60 lines (42 loc) · 1.93 KB
/
tiled_display.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#version 440
uniform vec3 iResolution; // viewport resolution (in pixels)
uniform float iTime; // shader playback time (in seconds)
uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click
uniform sampler2D iChannel0;
uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannel3;
in vec2 fragCoord;
out vec4 fragColor;
void main()
{
vec2 uv = gl_FragCoord.xy / iResolution.xy;
fragColor = vec4(uv,0.5+0.5*sin(iTime),1.0);
// int frame_number = int(floor(iTime / 16.66667));
// frame_number % 4;
// float c = float(iFrame%4)/4.0;
// uv /= 2.0;
// float b = texture(iChannel0, vec2(uv.x/3.0, uv.y)).r;
// float r = texture(iChannel0, vec2(1.0/3.0 + uv.x/3.0, uv.y)).r;
// float g = texture(iChannel0, vec2(2.0/3.0 + uv.x/3.0, uv.y)).r;
// float r = texture(iChannel0, vec2(uv.x/3.0, uv.y)).r;
// float g = texture(iChannel0, vec2(1.0/3.0 + uv.x/3.0, uv.y)).r;
// float b = texture(iChannel0, vec2(2.0/3.0 + uv.x/3.0, uv.y)).r;
// float g = texture(iChannel0, vec2(uv.x/3.0, uv.y)).r;
// float r = texture(iChannel0, vec2(1.0/3.0 + uv.x/3.0, uv.y)).r;
// float b = texture(iChannel0, vec2(2.0/3.0 + uv.x/3.0, uv.y)).r;
float g = texture(iChannel0, vec2(uv.x/3.0, uv.y)).r;
float b = texture(iChannel0, vec2(1.0/3.0 + uv.x/3.0, uv.y)).r;
float r = texture(iChannel0, vec2(2.0/3.0 + uv.x/3.0, uv.y)).r;
// float r = texture(iChannel0, vec2(uv.x, uv.y)).g;
// float g = texture(iChannel1, vec2(uv.x, uv.y)).g;
//float b = texture(iChannel2, vec2(uv.x, uv.y)).g;
// float g = texture(iChannel0, vec2(1.0/3.0 + uv.x/3.0, uv.y)).r;
// float b = texture(iChannel0, vec2(2.0/3.0 + uv.x/3.0, uv.y)).r;
fragColor = vec4(r, g, b, 1.0);
// fragColor = vec4(r);
// fragColor = vec4(g);
// fragColor = vec4(b);
// test direct texture map
// fragColor = vec4(uv, 0.0, 1.0);
}