aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2020-03-24 15:38:47 +0100
committerAdrian Kummerlaender2020-03-24 15:38:47 +0100
commit955f517f3dc235c2abc96160da10787c1718e778 (patch)
tree60afe4ed845d021ab9f228da8092873205d8762c
parente82f7c5b4210542adc7a9d9f83ef0a1e6b417389 (diff)
downloadboltzgas-955f517f3dc235c2abc96160da10787c1718e778.tar
boltzgas-955f517f3dc235c2abc96160da10787c1718e778.tar.gz
boltzgas-955f517f3dc235c2abc96160da10787c1718e778.tar.bz2
boltzgas-955f517f3dc235c2abc96160da10787c1718e778.tar.lz
boltzgas-955f517f3dc235c2abc96160da10787c1718e778.tar.xz
boltzgas-955f517f3dc235c2abc96160da10787c1718e778.tar.zst
boltzgas-955f517f3dc235c2abc96160da10787c1718e778.zip
Play around with colors
-rw-r--r--gas.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/gas.py b/gas.py
index f49d6ec..c1ccbce 100644
--- a/gas.py
+++ b/gas.py
@@ -55,12 +55,20 @@ particle_shader = Shader(
out vec3 color;
uniform mat4 projection;
+ uniform vec3 face_color;
+ uniform vec3 trace_color;
+ uniform uint trace_id;
void main() {
gl_Position = projection * vec4(particles, 0., 1.);
- color = vec3(0.0);
+
+ if (gl_VertexID == trace_id) {
+ color = trace_color;
+ } else {
+ color = face_color;
+ }
}""",
- uniform = ['projection']
+ uniform = ['projection', 'face_color', 'trace_color', 'trace_id']
)
decoration_shader = Shader(
@@ -138,7 +146,7 @@ class View:
self.projection = np.matmul(translation, projection)
def display(self):
- glClearColor(0.4,0.4,0.4,1.)
+ glClearColor(0.,0.,0.,1.)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
decoration_shader.use()
@@ -153,6 +161,9 @@ class View:
particle_shader.use()
glUniformMatrix4fv(particle_shader.uniform['projection'], 1, False, np.asfortranarray(self.projection))
+ glUniform3f(particle_shader.uniform['face_color'], 1., 1., 1.)
+ glUniform3f(particle_shader.uniform['trace_color'], 1., 0., 0.)
+ glUniform1ui(particle_shader.uniform['trace_id'], 4)
glEnable(GL_POINT_SPRITE)
glPointSize(2*radius*self.pixels_per_unit)
self.gas.gl_draw_particles()
@@ -195,7 +206,10 @@ class ColoredBox:
def get_histogram(velocities):
maxwellian = stats.maxwell.fit(velocities)
+ plt.style.use('dark_background')
+
fig = plt.figure(figsize=(10,10))
+ ax = fig.add_axes([0.1, 0.05, 0.88, 0.93])
plt.ylim(0, 0.003)
plt.ylabel('Probability')
@@ -316,7 +330,7 @@ gas = GasFlow(config, opengl = True, t_scale = 1.0)
tracer = Tracer(gas, 4)
histogram = VelocityHistogram(gas, [1.1,0], [1,1])
histogram.setup()
-view = View(gas, [ ColoredBox([0,0], [1,1], (1,1,1)), tracer ], [ histogram ])
+view = View(gas, [ ColoredBox([0,0], [1,1], (0.2,0.2,0.2)), tracer ], [ histogram ])
active = False