Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_tmx crash with atlas traceback in some cases #291

Open
ccanepa opened this issue Mar 26, 2017 · 1 comment
Open

load_tmx crash with atlas traceback in some cases #291

ccanepa opened this issue Mar 26, 2017 · 1 comment
Labels

Comments

@ccanepa
Copy link
Contributor

ccanepa commented Mar 26, 2017

reported in the ML at
https://groups.google.com/forum/#!topic/cocos-discuss/fjnyBKXhSqc

For certain specific data, the first snippet will traceback, the next two will run with no traceback:

#snippet 1: crash with traceback
import cocos
cocos.director.director.init()
sp = cocos.sprite.Sprite("Untitled.png")
tmx_data = cocos.tiles.load_tmx("untitled.tmx")
# snippet 2: no traceback
import cocos
cocos.director.director.init()
cocos.sprite.Sprite("Untitled.png")
tmx_data = cocos.tiles.load_tmx("untitled.tmx")
# snippet 3: no traceback
import cocos
cocos.director.director.init()
tmx_data = cocos.tiles.load_tmx("untitled.tmx")
sp = cocos.sprite.Sprite("Untitled.png")

The traceback, as seen in my system is

Traceback (most recent call last):
  File "helloworld.py", line 4, in <module>
    tmx_data = cocos.tiles.load_tmx("untitled.tmx")
  File "E:\tmp\cocos2d-0.6.4\cocos\tiles.py", line 327, in load_tmx
    column_padding=spacing)
  File "E:\tmp\cocos2d-0.6.4\cocos\tiles.py", line 634, in from_atlas
    gl.glBindTexture(tile_image.texture.target, id)
  File "E:\tmp\py35_pyglet_1.24\pyglet\gl\lib.py", line 104, in errcheck
    raise GLException(msg)
pyglet.gl.lib.GLException: b'operaci\xf3n no v\xe1lida'

(last line maps to 'pyglet.gl.lib.GLException: invalid operation')

additional info:

  • windows (64 bits), cocos2d 0.6.4 and pyglet 1.2.4 with Python version 3.5.2 32 bit , py 2.7.12 32bit and py 2.7.12 64bit (original report)
  • win7 64bits, py 3.5 64 bits, cocos 0.6.4, pyglet 1.2.4 (my tests)

Conjecture:

In the first snippet, I guess that by keeping a reference to the sprite the current cocos/pyglet 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.

In the 2nd snippet presumably the sprite is garbage collected, the atlas is cleared or garbage collected, so only the tiles texture need to fit in the atlas,

The 3rd snippet lets load_tmx start with an empty atlas, allowing to set all tiles textures, then the sprite texture is fit in the same atlas or in a new atlas if needed.

Added bugdemo in repo los-cocos/etc_code , at directory cocos#291-load_tmx_atlas_traceback

note: as pyglet dev after 1.2.4 changed atlas size, it is better to test with pyglet release 1.2.4 to reproduce;
even if the new atlas size gives no traceback, the underlying problem would be there.

Thanks Zorrent12 for the original report and bugdemo.

@ccanepa
Copy link
Contributor Author

ccanepa commented Mar 27, 2017

Updated initial report, added bugdemo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant