summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/demos/joglinterop/JoglInterop.cl
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-04-12 22:27:03 +0200
committerMichael Bien <[email protected]>2010-04-12 22:27:03 +0200
commit2c85c416d85205ab98b33e1a0b0daab32d4d81ff (patch)
tree4187ba06dec81da46495a300bb4f914e931f0c58 /src/com/jogamp/opencl/demos/joglinterop/JoglInterop.cl
parentb51f2e1c254cdd74c9e43904c62694f64e6ae7e6 (diff)
changes due to package renaming in jocl.
Diffstat (limited to 'src/com/jogamp/opencl/demos/joglinterop/JoglInterop.cl')
-rw-r--r--src/com/jogamp/opencl/demos/joglinterop/JoglInterop.cl23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/demos/joglinterop/JoglInterop.cl b/src/com/jogamp/opencl/demos/joglinterop/JoglInterop.cl
new file mode 100644
index 0000000..0f0bcfc
--- /dev/null
+++ b/src/com/jogamp/opencl/demos/joglinterop/JoglInterop.cl
@@ -0,0 +1,23 @@
+
+/**
+* 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) size;
+ float v = y / (float) size;
+
+ u = u*2.0f - 1.0f;
+ v = v*2.0f - 1.0f;
+
+ // calculate simple sine wave pattern
+ float freq = 4.0f;
+ float w = sin(u*freq + time) * cos(v*freq + time) * 0.5f;
+
+ // write output vertex
+ vertex[y*size + x] = (float4)(u*10.0f, w*10.0f, v*10.0f, 1.0f);
+}