aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl')
-rw-r--r--src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl b/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl
index 02356b2..cd92f14 100644
--- a/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl
+++ b/src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl
@@ -1,14 +1,15 @@
-/*
- * Simple kernel to modify vertex positions in sine wave pattern
- */
-__kernel void sineWave(__global float4 * pos, unsigned int width, unsigned int height, float time) {
+
+/**
+* animated 2D sine pattern.
+*/
+__kernel void sineWave(__global float4 * vertex, int size, float time) {
unsigned int x = get_global_id(0);
unsigned int y = get_global_id(1);
// calculate uv coordinates
- float u = x / (float) width;
- float v = y / (float) height;
+ float u = x / (float) size;
+ float v = y / (float) size;
u = u*2.0f - 1.0f;
v = v*2.0f - 1.0f;
@@ -18,6 +19,6 @@ __kernel void sineWave(__global float4 * pos, unsigned int width, unsigned int h
float w = sin(u*freq + time) * cos(v*freq + time) * 0.5f;
// write output vertex
- pos[y*width+x] = (float4)(u, w, v, 1.0f);
+ vertex[y*size + x] = (float4)(u*10.0f, w*10.0f, v*10.0f, 1.0f);
}