aboutsummaryrefslogtreecommitdiff
path: root/channel_3d_gl_interop.py
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-09-21 18:19:22 +0200
committerAdrian Kummerlaender2019-09-21 18:19:22 +0200
commitb770e7452c11cf0acdccf824c9c9304e9de3f08b (patch)
tree045e882b8c85fa5e1ed39f1ac0db8869a24baad8 /channel_3d_gl_interop.py
parent6bed7f80ea8e67c388f1c52a60237e7ceb8c274e (diff)
downloadsymlbm_playground-b770e7452c11cf0acdccf824c9c9304e9de3f08b.tar
symlbm_playground-b770e7452c11cf0acdccf824c9c9304e9de3f08b.tar.gz
symlbm_playground-b770e7452c11cf0acdccf824c9c9304e9de3f08b.tar.bz2
symlbm_playground-b770e7452c11cf0acdccf824c9c9304e9de3f08b.tar.lz
symlbm_playground-b770e7452c11cf0acdccf824c9c9304e9de3f08b.tar.xz
symlbm_playground-b770e7452c11cf0acdccf824c9c9304e9de3f08b.tar.zst
symlbm_playground-b770e7452c11cf0acdccf824c9c9304e9de3f08b.zip
Extract GL moments, particle buffers and add texture buffer
Diffstat (limited to 'channel_3d_gl_interop.py')
-rw-r--r--channel_3d_gl_interop.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/channel_3d_gl_interop.py b/channel_3d_gl_interop.py
index a9633c4..e509e45 100644
--- a/channel_3d_gl_interop.py
+++ b/channel_3d_gl_interop.py
@@ -3,6 +3,7 @@ from string import Template
from simulation import Lattice, Geometry
from utility.particles import Particles
+from utility.opengl import MomentsVertexBuffer
from symbolic.generator import LBM
import symbolic.D3Q27 as D3Q27
@@ -238,10 +239,11 @@ primitives = list(map(lambda material: material[0], filter(lambda material: no
lattice.apply_material_map(material_map)
lattice.sync_material()
+moments_vbo = MomentsVertexBuffer(lattice)
+
particles = Particles(
- lattice.context,
- lattice.queue,
- lattice.memory.float_type,
+ lattice,
+ moments_vbo,
numpy.mgrid[
2*lattice.geometry.size_x//100:4*lattice.geometry.size_x//100:particle_count/10000j,
lattice.geometry.size_y//16:15*lattice.geometry.size_y//16:100j,
@@ -256,10 +258,10 @@ def on_display():
for i in range(0,updates_per_frame):
lattice.evolve()
- lattice.collect_gl_moments()
+ moments_vbo.collect()
for i in range(0,updates_per_frame):
- lattice.update_gl_particles(particles, aging = True)
+ particles.update(aging = True)
lattice.sync()
@@ -268,13 +270,10 @@ def on_display():
glEnable(GL_DEPTH_TEST)
glDepthFunc(GL_LESS)
- glEnableClientState(GL_VERTEX_ARRAY)
- particles.gl_particles.bind()
-
shaders.glUseProgram(particle_program)
glUniformMatrix4fv(projection_id, 1, False, numpy.ascontiguousarray(projection))
glUniformMatrix4fv(rotation_id, 1, False, numpy.ascontiguousarray(rotation.get()))
- glVertexPointer(4, GL_FLOAT, 0, particles.gl_particles)
+ particles.bind()
glEnable(GL_POINT_SMOOTH)
glPointSize(point_size)
glDrawArrays(GL_POINTS, 0, particles.count)