Pyglet Not Running Properly On Amd Hd4250
I am building an python program using pyglet. The source code runs just fine on any computer exept for my laptop. My Laptop is also the only one with a AMD graphics card: the HD425
Solution 1:
What does the following code produce: (It's not limited to a certain frame buffer per se so it might produce better output)
#!/usr/bin/pythonimport pyglet
from time import time, sleep
classWindow(pyglet.window.Window):
def__init__(self, refreshrate):
super(Window, self).__init__(vsync = False)
self.frames = 0
self.framerate = pyglet.text.Label(text='Unknown', font_name='Verdana', font_size=8, x=10, y=10, color=(255,255,255,255))
self.last = time()
self.alive = 1
self.refreshrate = refreshrate
self.click = None
self.drag = Falsedefon_draw(self):
self.render()
defon_mouse_press(self, x, y, button, modifiers):
self.click = x,y
defon_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
if self.click:
self.drag = Trueprint'Drag offset:',(dx,dy)
defon_mouse_release(self, x, y, button, modifiers):
ifnot self.drag and self.click:
print'You clicked here', self.click, 'Relese point:',(x,y)
else:
print'You draged from', self.click, 'to:',(x,y)
self.click = None
self.drag = Falsedefrender(self):
self.clear()
if time() - self.last >= 1:
self.framerate.text = str(self.frames)
self.frames = 0
self.last = time()
else:
self.frames += 1
self.framerate.draw()
self.flip()
defon_close(self):
self.alive = 0defrun(self):
while self.alive:
self.render()
# ----> Note: <----# Without self.dispatc_events() the screen will freeze# due to the fact that i don't call pyglet.app.run(),# because i like to have the control when and what locks# the application, since pyglet.app.run() is a locking call.
event = self.dispatch_events()
sleep(1.0/self.refreshrate)
win = Window(23) # set the fps
win.run()
You could try to force specific drawing methods that might work with the open driver you're using, stuff like:
glEnable(GL_TEXTURE_2D)
and
glClear(GL_COLOR_BUFFER_BIT)
glLoadIdentity()
glBegin(GL_TRIANGLES)
glVertex2f(0, 0)
glVertex2f(window.width, 0)
glVertex2f(window.width, window.height)
glEnd()
Post a Comment for "Pyglet Not Running Properly On Amd Hd4250"