Hi, I'm having problems with image-loading, but only under certain conditions.
It works fine on Linux, but
not Windows 7 64-bit. Looking at older posts, it seems like there might have
once been an issue running
under 64-bit Windows, but if more recent posts are correct, that seems to be
working.
I can load an image if it's 1024x1024 - but if it's one pixel larger, then
things bomb:
import os
from pyglet import image
#img_file = os.path.normpath(r'C:foo_good.png') # 1024x1024 image - works
img_file = os.path.normpath(r'C:foo_bad.png') # 1025x1025 image - bombs
img = image.load(img_file)
foo = img.get_texture()
print "texture = ", foo # texture = <Texture 1024x1024>
Traceback (most recent call last):
File "C:/test_display.py", line 38, in <module>
foo = img.get_texture()
File "C:\site-packages\pyglet\image\__init__.py", line 818, in
get_texture.force_rectangle)
File "C:\site-packages\pyglet\image\__init__.py", line 803, in
create_texture.rectangle, force_rectangle)
File "C:\site-packages\pyglet\image\__init__.py", line 1517, in
create.blank)
File "C:\site-packages\pyglet\gl\lib.py", line 104, in errcheck
raise GLException(msg)
pyglet.gl.lib.GLException: invalid value
Point of Failure in the Code:
image\__init__.py
class Texture(AbstractImage):
def create(cls, width, height, internalformat=GL_RGBA,
rectangle=False, force_rectangle=False,
min_filter=GL_LINEAR, mag_filter=GL_LINEAR):
...
# Fails on one of these two lines:
blank = (GLubyte * (texture_width * texture_height * 4))() # line
1508
glTexImage2D(target, 0, ..., blank)
That first line bothered me, had to break it down, see what was happening. So
it appears that
magically, multiplying an Int by a ubyte creates a <class
'pyglet.image.c_ubyte_Array_4194304'>,
which is itself, a Callable().
foo = GLubyte * (texture_width * texture_height * 4)
blank = (foo)()
Another person having the same problem:
http://stackoverflow.com/questions/17508702/loading-an-image-using-pyglet
My system config:
Windows 7 64-bit
Python 2.7.11
Pyglet 1.2.4
DirectX 11
Screensize = 1920x1080
Thanks.
John C>
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.