24 lines
490 B
GLSL
24 lines
490 B
GLSL
#version 120
|
|
varying vec2 frag;
|
|
// input
|
|
uniform sampler2D texture_sampler;
|
|
uniform vec2 seed;
|
|
uniform int iteration;
|
|
|
|
void main() {
|
|
vec2 z = frag;
|
|
int i;
|
|
for (i = 0; i < iteration; i++) {
|
|
float x = (z.x * z.x - z.y * z.y) + seed.x;
|
|
float y = (z.y * z.x + z.x * z.y) + seed.y;
|
|
if ((x * x + y * y) > 4.0) break;
|
|
z.x = x;
|
|
z.y = y;
|
|
}
|
|
if (i == iteration) {
|
|
discard;
|
|
} else {
|
|
gl_FragColor = texture2D(texture_sampler, vec2(float(i)) / 100.0, 0.25);
|
|
}
|
|
}
|