Joshua Moerman
11 years ago
11 changed files with 78 additions and 22 deletions
@ -0,0 +1,9 @@ |
|||||
|
[submodule "contrib/CLWrapper"] |
||||
|
path = contrib/CLWrapper |
||||
|
url = ../libJ/CLWrapper/ |
||||
|
[submodule "contrib/NSAppWrapper"] |
||||
|
path = contrib/NSAppWrapper |
||||
|
url = ../libJ/NSAppWrapper/ |
||||
|
[submodule "contrib/ImageStreams"] |
||||
|
path = contrib/ImageStreams |
||||
|
url = ../ImageStreams/ |
@ -0,0 +1,4 @@ |
|||||
|
|
||||
|
add_subdirectory("NSAppWrapper") |
||||
|
add_subdirectory("CLWrapper") |
||||
|
add_subdirectory("ImageStreams") |
@ -0,0 +1,26 @@ |
|||||
|
#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; |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
#version 330 |
||||
|
|
||||
|
uniform float rotation; |
||||
|
|
||||
|
in vec4 position; |
||||
|
in vec4 color; |
||||
|
|
||||
|
out vec2 pos; |
||||
|
out vec2 start; |
||||
|
|
||||
|
void main(){ |
||||
|
pos = position.xy; |
||||
|
pos.x -= 0.5; |
||||
|
|
||||
|
start = sqrt(1.0 + 0.01 * rotation) * 0.3 * sin(vec2(0.1, 0.1337) * rotation); |
||||
|
|
||||
|
gl_Position = position; |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
|
||||
|
kernel void square(global float* input, size_t width, global float* output){ |
||||
|
size_t x = get_global_id(0); |
||||
|
size_t y = get_global_id(1); |
||||
|
float i = 2.0 * (input[x + width*y] - 0.5); |
||||
|
output[x + width*y] = 0.5 + 0.5*sin((1.0 - i) * sin(i*i + 6.2*float(x)/width) + cos(1.0/i + 6.2*float(y)/width)); |
||||
|
} |
||||
|
|
Reference in new issue