-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvolume.py
37 lines (30 loc) · 953 Bytes
/
volume.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
__author__ = 'james'
from pyglet.gl import *
from OpenGL.GLUT import *
from object_3d import Object3D
import colors
class Volume(Object3D):
def __init__(self, color):
Object3D.__init__(self)
self.color = color
def update(self, delta):
# currently just rotating about y-axis on every frame
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glLoadMatrixf(self.OM)
#glRotatef(delta * 10, 0, 1, 0) # Rotate about y-axis
glGetFloatv(GL_MODELVIEW_MATRIX, self.OM)
glPopMatrix()
pass
def draw(self):
glMatrixMode(GL_MODELVIEW)
glDisable(GL_LIGHTING)
glPushMatrix()
glMultMatrixf(self.OM)
glScalef(1.5, 1.0, 1.0)
glColor4fv(self.color)
glMaterialfv(GL_FRONT, GL_SPECULAR, colors.WHITE)
glMateriali(GL_FRONT, GL_SHININESS, 60)
glutWireCube(1000)
glEnable(GL_LIGHTING)
glPopMatrix()