aboutsummaryrefslogtreecommitdiff
path: root/boltzgas/visual/box.py
diff options
context:
space:
mode:
Diffstat (limited to 'boltzgas/visual/box.py')
-rw-r--r--boltzgas/visual/box.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/boltzgas/visual/box.py b/boltzgas/visual/box.py
new file mode 100644
index 0000000..0a6ab5a
--- /dev/null
+++ b/boltzgas/visual/box.py
@@ -0,0 +1,16 @@
+from OpenGL.GL import *
+
+class ColoredBox:
+ def __init__(self, origin, extend, color):
+ self.origin = origin
+ self.extend = extend
+ self.color = color
+
+ def display(self, uniform):
+ glUniform3f(uniform['face_color'], *self.color)
+ glBegin(GL_TRIANGLE_STRIP)
+ glVertex(self.origin[0], self.origin[1] , 0.)
+ glVertex(self.origin[0] + self.extend[0], self.origin[1] , 0.)
+ glVertex(self.origin[0] , self.origin[1] + self.extend[1], 0.)
+ glVertex(self.origin[0] + self.extend[1], self.origin[1] + self.extend[1], 0.)
+ glEnd()