Images don't render on my machine. I wonder if others are having this
problem? I've tracked the problem down to the QuartzImageDecoder--it
returns image data of all zeros. If I delete that decode and use the
pyglet.image.codecs.png.PNGImageDecoder, it works. Any ideas on this
problem?
The commit of Pyglet I'm using is in HG:
67[tip] d88c2ed1d638 2012-03-03 22:05 -0800 winstonw
Working on python2.7 64-bit by using Pyglet 1.2dev and pyobjc v2.2
Mac OS X 10.7.3
Below is a test-program that illustrates the problem, and here is the
output:
-------------
% python /tmp/tspyglet.py
Demonstration of failing PNG decoder on Mac OS 10.7.3
Here are the current image decoders available, and the ones for PNGs:
get_decoders: [<pyglet.image.codecs.quartz.QuartzImageDecoder
object at 0x10b2a9050>, <pyglet.image.codecs.png.PNGImageDecoder
object at 0x10b2a9390>, <pyglet.image.codecs.dds.DDSImageDecoder
object at 0x1087d3450>, <pyglet.image.codecs.bmp.BMPImageDecoder
object at 0x10b2a9490>]
_decoder_extensions[.png]=
[<pyglet.image.codecs.quartz.QuartzImageDecoder object at
0x10b2a9050>, <pyglet.image.codecs.png.PNGImageDecoder object at
0x10b2a9390>]
Load an image using the default decoder, i.e. QuartzImageDecoder.
Notice that the returned Image
has zeros for it's data.
raw png data: '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01,'
image data:
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Now remove the QuartzImageDecoder so we use the
pyglet.image.codecs.png.PNGImageDecoder.
It creates good Image.data
_decoder_extensions[.png]=
[<pyglet.image.codecs.png.PNGImageDecoder object at 0x10b2a9390>]
raw png data: '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01,'
image data: '\xff\xff\xff\x00\xff\xff\xff\x00\xff\xff\xff\x00\xff
\xff\xff\x00\xff\xff\xff\x00'
---------------
import pyglet
window = pyglet.window.Window()
filename = ('/tmp/SimpsonsWinston.png')
print '''Demonstration of failing PNG decoder on Mac OS 10.7.3
Here are the current image decoders available, and the ones for
PNGs:'''
print ' get_decoders:', pyglet.image.codecs.get_decoders(filename)
print ' _decoder_extensions[.png]=',
pyglet.image.codecs._decoder_extensions['.png']
print '''
Load an image using the default decoder, i.e. QuartzImageDecoder.
Notice that the returned Image
has zeros for it's data.'''
image = pyglet.image.load(filename)
print ' raw png data:', repr(open(filename).read()[:20])
print ' image data:', repr(image.data[:20])
print '''
Now remove the QuartzImageDecoder so we use the
pyglet.image.codecs.png.PNGImageDecoder.
It creates good Image.data'''
del pyglet.image.codecs._decoder_extensions['.png'][0]
print ' _decoder_extensions[.png]=',
pyglet.image.codecs._decoder_extensions['.png']
image = pyglet.image.load(filename)
print ' raw png data:', repr(open(filename).read()[:20])
print ' image data:', repr(image.data[:20])
# @window.event
# def on_draw():
# window.clear()
# image.blit(10, 10)
# pyglet.app.run()
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en.