Lock the animation at 60 FPS
This commit is contained in:
parent
abc4d1976c
commit
d300b2279c
1 changed files with 7 additions and 2 deletions
|
@ -25,6 +25,7 @@ from OpenGL.GLUT import *
|
||||||
##
|
##
|
||||||
MIN_INC = -100
|
MIN_INC = -100
|
||||||
MAX_INC = 100
|
MAX_INC = 100
|
||||||
|
FPS = 60
|
||||||
|
|
||||||
##
|
##
|
||||||
# Variables globales
|
# Variables globales
|
||||||
|
@ -71,8 +72,9 @@ varAnim = [randint(-100, 100),
|
||||||
randint(-100, 100),
|
randint(-100, 100),
|
||||||
randint(-100, 100)]
|
randint(-100, 100)]
|
||||||
|
|
||||||
incAnim = [0.1, 0.1, 0.1, 0.1]
|
# incAnim = [0.1, 0.1, 0.1, 0.1]
|
||||||
|
# incAnim = [0.05, 0.05, 0.05, 0.05]
|
||||||
|
incAnim = [1.0, 1.0, 1.0, 1.0]
|
||||||
|
|
||||||
# fonction d'affichage principale
|
# fonction d'affichage principale
|
||||||
def draw():
|
def draw():
|
||||||
|
@ -306,6 +308,7 @@ def draw_hypercube(a1, b1, c1, d1):
|
||||||
pg.init()
|
pg.init()
|
||||||
windowSize = (1152, 720)
|
windowSize = (1152, 720)
|
||||||
pg.display.set_mode(windowSize, DOUBLEBUF | OPENGL)
|
pg.display.set_mode(windowSize, DOUBLEBUF | OPENGL)
|
||||||
|
clock = pg.time.Clock()
|
||||||
|
|
||||||
# setup PoV
|
# setup PoV
|
||||||
gluPerspective(60, (windowSize[0]/windowSize[1]), 0.1, 100.0)
|
gluPerspective(60, (windowSize[0]/windowSize[1]), 0.1, 100.0)
|
||||||
|
@ -317,5 +320,7 @@ while True:
|
||||||
if event.type == pg.KEYDOWN:
|
if event.type == pg.KEYDOWN:
|
||||||
keyboard(event.key)
|
keyboard(event.key)
|
||||||
|
|
||||||
|
# print('FPS: ' + str(clock.get_fps()))
|
||||||
|
clock.tick(FPS)
|
||||||
draw()
|
draw()
|
||||||
pg.display.flip()
|
pg.display.flip()
|
||||||
|
|
Loading…
Reference in a new issue