summaryrefslogtreecommitdiffstats
path: root/balls.cl
diff options
context:
space:
mode:
Diffstat (limited to 'balls.cl')
-rw-r--r--balls.cl7
1 files changed, 5 insertions, 2 deletions
diff --git a/balls.cl b/balls.cl
index 47bd7aa..4fdc900 100644
--- a/balls.cl
+++ b/balls.cl
@@ -15,10 +15,13 @@ float volume(float radius);
__kernel void
move(__global float2 *positions, __global float2 *velocities) {
size_t id;
+ float2 v;
id = get_global_id(0);
- velocities[id].y -= G / FPS;
- positions[id] += velocities[id] / FPS;
+ v = velocities[id];
+ v.y -= G / FPS;
+ positions[id] += v / FPS;
+ velocities[id] = v;
}
__kernel void