1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
opencl-experiment/Fractal.fsh

26 lines
435 B
GLSL

#version 330
uniform float rotation;
in vec2 pos;
in vec2 start;
out vec4 fragColor;
void main(){
vec2 z = start;
int i = 0;
for (i = 0; i < 30; i++) {
vec2 zsq = z*z;
if(zsq.x + zsq.y > 16.0) break;
float t = zsq.x - zsq.y + pos.x;
z.y = 2.0*z.x*z.y + pos.y;
z.x = t;
}
fragColor = vec4(float(i) / 30.0);
fragColor.bg = 0.5 * sin(z) + 0.5;
}