aboutsummaryrefslogtreecommitdiff
path: root/utility
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-09-06 22:29:05 +0200
committerAdrian Kummerlaender2019-09-06 22:29:05 +0200
commitbf967631c146997d7673798318d94b0a186ec89d (patch)
treeef3721d80ec65561fb2af1e371e9e501e5819765 /utility
parent3b2d08e57a272f14c1385ebc458f0c2b431414b9 (diff)
downloadsymlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.gz
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.bz2
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.lz
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.xz
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.tar.zst
symlbm_playground-bf967631c146997d7673798318d94b0a186ec89d.zip
Add a fun little fake bonfire _simulation_
…using appropriately colored aging particles
Diffstat (limited to 'utility')
-rw-r--r--utility/particles.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/utility/particles.py b/utility/particles.py
index b838790..43f32a3 100644
--- a/utility/particles.py
+++ b/utility/particles.py
@@ -7,7 +7,7 @@ import OpenGL.GL as gl
from OpenGL.arrays import vbo
class Particles:
- def __init__(self, context, float_type, grid):
+ def __init__(self, context, queue, float_type, grid):
self.context = context
self.count = len(grid)
@@ -16,6 +16,11 @@ class Particles:
self.np_particles[:,0:2] = grid
self.np_particles[:,2:4] = self.np_particles[:,0:2]
+ self.np_init_particles = numpy.ndarray(shape=(self.count, 2), dtype=float_type)
+ self.np_init_particles[:,0:2] = grid
+ self.cl_init_particles = cl.Buffer(context, mf.READ_ONLY, size=self.count * 2*numpy.float32(0).nbytes)
+ cl.enqueue_copy(queue, self.cl_init_particles, self.np_init_particles).wait();
+
self.gl_particles = vbo.VBO(data=self.np_particles, usage=gl.GL_DYNAMIC_DRAW, target=gl.GL_ARRAY_BUFFER)
self.gl_particles.bind()
self.cl_gl_particles = cl.GLBuffer(self.context, mf.READ_WRITE, int(self.gl_particles))