diff options
author | Michael Bien <[email protected]> | 2009-11-05 02:57:24 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-11-05 02:57:24 +0100 |
commit | e6e94ab1c51654355c0df27a505c18bfe77fdc80 (patch) | |
tree | b88bd25858419c714aafa7599cd30149f8cb6fa6 /src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl | |
parent | 92e523588e6ebb9ef6b7ad3156930b8e0ea2597f (diff) |
finished JOGL-JOCL interoperability demo.
Diffstat (limited to 'src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl')
-rw-r--r-- | src/com/mbien/opencl/demos/joglinterop/JoglInterop.cl | 15 |
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); } |