Stashing all your files in a directory and fixing the path to
tmw_desert_spacing.png in the tmx I can reproduce your issue:
with the .py as send it does not crash; assigning the sprite to a name will
produce the crash you found.
additional info: win7, py 3.5, cocos 0.6.4, pyglet 1.2.4
My guess is that by keeping a reference to the sprite the current code
tries to put the sprite texture and the tiles textures in the same atlas,
but the cocos/pyglet code can't fit all in the same texture.
To test that I changed the code to instantiate first the map, then the
sprite:
import cocos
cocos.director.director.init()
tmx_data = cocos.tiles.load_tmx("untitled.tmx")
sp = cocos.sprite.Sprite("Untitled.png")
This does not traceback.
I think that letting cocos.tiles start with an empty atlas gives more
chances to succeed.
Probably cocos.tiles at least should ensure to start with an empty atlas,
and report if it can't add all the tiles.
I filled issue #291 for this problem,
https://github.com/los-cocos/cocos/issues/291
To be continued ...
On Sun, Mar 26, 2017 at 3:55 PM, Zorrent12 <[email protected]> wrote:
> Thank you for your response. I'm using cocos2d 0.6.4 and pyglet 1.2.4 with
> Python version 3.5.2 32 bit.
>
> Going into specifics about the resources, untitled.png is a 1342 by 580
> pixels blank (completely white) image created in microsoft paint;
> untitled.tmx is a 10 by 10 map created using Tiled (the program from
> mapeditor.org, a website mentioned on the Cocos Python tutorial) with the
> tileset tmw_desert_spacing.png, which comes with Tiled as a sample tileset.
> I've attached helloworld.py, tmw_desert_spacing.png, Untitled.png, and
> untitled.tmx to this post.
>
> On a related note, so long as untitled.tmx doesn't have a tileset
> associated with it, I won't encounter an issue with cocos.tiles.load_tmx
> after instantiating cocos.sprite.Sprite (whether or not it's bound to a
> reference).
>
> While I'm no expert on disagreement between resources, what you think
> might be happening sounds about right. However, it doesn't appear to be an
> issue specifically between Untitled.png and untitled.tmx; the code I
> provided was my attempt to replicate with as little code as possible an
> issue I encountered while dealing with sprites created from images other
> than Untitled.png and a map other than untitled.tmx. While untitled.tmx
> does use the same tileset, I encountered the same issue using
> buch-outdoor.png, another tileset that comes with Tiled.exe as a sample
> tileset. After reading your reply, I created a .jpg and .gif version of
> Untitled.png and tried running code that created a sprite from those, but
> still encountered the error.
>
> I also attempted running the code with different versions of Python. I
> received the following exception with Python 2.7.12 32bit:
>
> Traceback (most recent call last):
>> File "C:/Users/Lucas/PycharmProjects/HelloWorld/Test/helloworld.py",
>> line 6, in <module>
>> cocos.tiles.load_tmx("untitled.tmx")
>> File "C:\Program Files
>> (x86)\Python\Python27\lib\site-packages\cocos\tiles.py",
>> line 327, in load_tmx
>> column_padding=spacing)
>> File "C:\Program Files
>> (x86)\Python\Python27\lib\site-packages\cocos\tiles.py",
>> line 634, in from_atlas
>> gl.glBindTexture(tile_image.texture.target, id)
>> File "C:\Program Files (x86)\Python\Python27\lib\
>> site-packages\pyglet\gl\lib.py", line 104, in errcheck
>> raise GLException(msg)
>> pyglet.gl.lib.GLException: invalid operation
>>
>
> I received the following exception with Python 2.7.12 64bit:
>
> Traceback (most recent call last):
>> File "C:/Users/Lucas/PycharmProjects/HelloWorld/Test/helloworld.py",
>> line 6, in <module>
>> cocos.tiles.load_tmx("untitled.tmx")
>> File "C:\Program
>> Files\Python\Python27\lib\site-packages\cocos2d-0.6.4-py2.7.egg\cocos\tiles.py",
>> line 327, in load_tmx
>> column_padding=spacing)
>> File "C:\Program
>> Files\Python\Python27\lib\site-packages\cocos2d-0.6.4-py2.7.egg\cocos\tiles.py",
>> line 634, in from_atlas
>> gl.glBindTexture(tile_image.texture.target, id)
>> File "_build\bdist.win-amd64\egg\pyglet\gl\lib.py", line 104, in
>> errcheck
>> pyglet.gl.lib.GLException: invalid operation
>
> --
> You received this message because you are subscribed to the Google Groups
> "cocos2d discuss" 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/cocos-discuss.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" 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/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.