comparison pytouhou/ui/anmrenderer.py @ 382:b9aecdc6f72f

Fix the anmviewer, broken since changeset 370:74471afbac37.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 07 Sep 2012 13:04:30 +0200
parents f3099ebf4f61
children 690b5faaa0e6
comparison
equal deleted inserted replaced
381:f1649d6c6397 382:b9aecdc6f72f
16 import pyglet 16 import pyglet
17 import traceback 17 import traceback
18 18
19 from pyglet.gl import (glMatrixMode, glLoadIdentity, glEnable, 19 from pyglet.gl import (glMatrixMode, glLoadIdentity, glEnable,
20 glHint, glEnableClientState, glViewport, 20 glHint, glEnableClientState, glViewport,
21 gluPerspective, GL_PROJECTION, 21 glLoadMatrixf, GL_PROJECTION, GL_MODELVIEW,
22 GL_TEXTURE_2D, GL_BLEND, 22 GL_TEXTURE_2D, GL_BLEND,
23 GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST, 23 GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST,
24 GL_COLOR_ARRAY, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY, 24 GL_COLOR_ARRAY, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY,
25 glClearColor, glClear, GL_COLOR_BUFFER_BIT) 25 glClearColor, glClear, GL_COLOR_BUFFER_BIT)
26 26
65 glEnableClientState(GL_COLOR_ARRAY) 65 glEnableClientState(GL_COLOR_ARRAY)
66 glEnableClientState(GL_VERTEX_ARRAY) 66 glEnableClientState(GL_VERTEX_ARRAY)
67 glEnableClientState(GL_TEXTURE_COORD_ARRAY) 67 glEnableClientState(GL_TEXTURE_COORD_ARRAY)
68 68
69 # Switch to game projection 69 # Switch to game projection
70 proj = self.perspective(30, float(self.width) / float(self.height),
71 101010101./2010101., 101010101./10101.)
70 glMatrixMode(GL_PROJECTION) 72 glMatrixMode(GL_PROJECTION)
71 glLoadIdentity() 73 glLoadMatrixf(proj.get_c_data())
72 gluPerspective(30, float(self.width) / float(self.height),
73 101010101./2010101., 101010101./10101.)
74 74
75 self.setup_camera(0, 0, 1) 75 view = self.setup_camera(0, 0, 1)
76 glMatrixMode(GL_MODELVIEW)
77 glLoadMatrixf(view.get_c_data())
76 78
77 # Use our own loop to ensure 60 fps 79 # Use our own loop to ensure 60 fps
78 pyglet.clock.set_fps_limit(60) 80 pyglet.clock.set_fps_limit(60)
79 while not self.has_exit: 81 while not self.has_exit:
80 pyglet.clock.tick() 82 pyglet.clock.tick()