-1

I am using the latest pyglet and having extreme trouble displaying images. I have stripped my code down to the bare essentials and am baffled by the result:

import pyglet

pyglet.resource.path.append('Assets')
pyglet.resource.reindex()

look = pyglet.resource.image('skybox0.jpg')
print('image size',(look.width, look.height))

window = pyglet.window.Window(800, 600, caption='check my Cube Maps')

@window.event
def on_draw():
    window.clear
    look.blit(0,0)
    return

pyglet.app.run()

Here's what happens:

image size (256, 197)
Traceback (most recent call last):
 File "C:/Python/Python36/Dhruve and me/Pyglet/skybox look.py", line 19, in <module>
   pyglet.app.run()
 File "C:\Python\Python36\lib\site-packages\pyglet\app\__init__.py", line 107, in run
   event_loop.run()
 File "C:\Python\Python36\lib\site-packages\pyglet\app\base.py", line 167, in run
   timeout = self.idle()
 File "C:\Python\Python36\lib\site-packages\pyglet\app\base.py", line 243, in idle
   window.dispatch_event('on_draw')
 File "C:\Python\Python36\lib\site-packages\pyglet\window\__init__.py", line 1333, in dispatch_event
   if EventDispatcher.dispatch_event(self, *args) != False:
 File "C:\Python\Python36\lib\site-packages\pyglet\event.py", line 408, in dispatch_event
   if handler(*args):
 File "C:/Python/Python36/Dhruve and me/Pyglet/skybox look.py", line 16, in on_draw
   look.blit(0,0)
 File "C:\Python\Python36\lib\site-packages\pyglet\image\__init__.py", line 1614, in blit
   glInterleavedArrays(GL_T4F_V4F, 0, array)
 File "C:\Python\Python36\lib\site-packages\pyglet\gl\lib.py", line# 107, in errcheck
   raise GLException(msg)
pyglet.gl.lib.GLException: None

The image happens to be a skybox which displays fine when viewed by windows explorer. I'm on windows10 and python36.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Nick
  • 97
  • 10
  • Have you tried other images? – Alderven May 16 '20 at 13:34
  • I get the same result with any of my .jpg and ,png images – Nick May 18 '20 at 09:34
  • I can't reproduce this issue. But a small hygenic thing would be to remove the `return` in your `on_draw`, doesn't really do anything and there for serves no purpose :) Also `window.clear` should be `window.clear()`, otherwise you're not actually calling the function :) How big is your image and how fast does this issue come for you? – Torxed May 18 '20 at 16:30

1 Answers1

0

Thanks v much for your suggestion -
correcting the .clear to .clear() made it work perfectly. I need to see an optician...

Nick
  • 97
  • 10