It shouldn't be a problem either way, as you can see running these two
variants in the cocos/test directory

import cocos

cocos.director.director.init()
cocos.sprite.Sprite("car.png")
cocos.tiles.load_tmx("road-map.tmx")

or

cocos.director.director.init()
sprite = cocos.sprite.Sprite("car.png")
cocos.tiles.load_tmx("road-map.tmx")

There's the possibility that the combination of resources loaded in
"untitled.png" and "untitled.tmx" be problematic.

To be more specific theres a need to know:
  - which pyglet version (changeset if from repo, there are changes in
texture atlas there)
  - which cocos version (sha1 if from repo)
  - representative samples of "untitled.png", "untitled.tmx" and any
resource used in the .tmx




On Sat, Mar 25, 2017 at 10:01 PM, Zorrent12 <[email protected]> wrote:

> If I invoke cocos.sprite.Sprite's __init__ and add the sprite to another
> cocosnode or assign the sprite to a reference, calling cocos.tiles.load_tmx
> without issue causes the following exception: pyglet.gl.lib.GLException:
> b'invalid operation'. This seems like a bit of a hurdle to get over, so I'd
> like to know if I'm doing something wrong that's causing this or there's
> any way to be able to use cocos.tiles.load_tmx while there are instances of
> cocos.sprite.Sprite floating around.
>
> When I run the following code, I receive no exception.
>
> import cocos
>
> cocos.director.director.init()
> cocos.sprite.Sprite("Untitled.png")
> cocos.tiles.load_tmx("untitled.tmx")
>
> However, when I change the code to assign the instance of
> cocos.sprite.Sprite to a reference as follows:
>
> import cocos
>
> cocos.director.director.init()
> sprite = cocos.sprite.Sprite("Untitled.png")
> cocos.tiles.load_tmx("untitled.tmx")
>
> I receive the following exception:
>
> C:\Test>python helloworld.py
>> Traceback (most recent call last):
>>   File "helloworld.py", line 5, in <module>
>>     cocos.tiles.load_tmx("untitled.tmx")
>>   File "C:\Program Files 
>> (x86)\Python\Python35-32\lib\site-packages\cocos\tiles.py",
>> line 327, in load_tmx
>>     column_padding=spacing)
>>   File "C:\Program Files 
>> (x86)\Python\Python35-32\lib\site-packages\cocos\tiles.py",
>> line 634, in from_atlas
>>     gl.glBindTexture(tile_image.texture.target, id)
>>   File "C:\Program Files (x86)\Python\Python35-32\lib\
>> site-packages\pyglet\gl\lib.py", line 104, in errcheck
>>     raise GLException(msg)
>> pyglet.gl.lib.GLException: b'invalid operation'
>
>
> As I stated, if anyone can explain why this is happening and possibly how
> to work around this issue, I'd be grateful. Thank you for taking the time
> to read my post, and sorry if this doesn't belong here.
>
> --
> 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.

Reply via email to