Skip to content

Commit 3dd63f1

Browse files
committed
adding-frag-shader for loadFilterShader
1 parent d72744a commit 3dd63f1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
precision highp float; varying vec2 vPos;
2+
uniform vec2 p;
3+
uniform float r;
4+
const int I = 500;
5+
void main() {
6+
vec2 c = p + vPos * r, z = c;
7+
float n = 0.0;
8+
for (int i = I; i > 0; i --) {
9+
if(z.x*z.x+z.y*z.y > 4.0) {
10+
n = float(i)/float(I);
11+
break;
12+
}
13+
z = vec2(z.x*z.x-z.y*z.y, 2.0*z.x*z.y) + c;
14+
}
15+
gl_FragColor = vec4(0.5-cos(n*17.0)/2.0,0.5-cos(n*13.0)/2.0,0.5-cos(n*23.0)/2.0,1.0);
16+
}

0 commit comments

Comments
 (0)