-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMass-Spring.py
More file actions
44 lines (33 loc) · 1.06 KB
/
Mass-Spring.py
File metadata and controls
44 lines (33 loc) · 1.06 KB
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
38
39
40
41
42
43
44
import pygame
from OpenGL.GL import *
from OpenGL.GLU import *
from Drawings import *
def setup():
# Setting Up the screen resolution and the buffers and then the initial camera position
pygame.init()
display = (800, 600)
pygame.display.set_mode(display, DOUBLEBUF | OPENGL)
# glEnable(GL_CULL_FACE)
# glEnable(GL_LIGHTING)
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE)
glEnable(GL_COLOR_MATERIAL)
glEnable(GL_LIGHT0)
glLightfv(GL_LIGHT0, GL_POSITION, [10, 10, 10])
glMatrixMode(GL_MODELVIEW)
gluPerspective(45, (display[0]/display[1]), 0.1, 250.0)
glTranslatef(0.0, 5, -30)
glRotate(-45, 1, 0, 1)
def main():
setup()
pygame.display.set_caption('MS')
while True: # Catch close window event
target = eventsHandle(returnCoords=True)
# Clear buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# Draw a grid
drawGrid(0)
pygame.time.get_ticks()
pygame.display.flip()
pygame.time.wait(5)
if __name__ == "__main__":
main()