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

error 'cannot share context' while import cocos.particle_systems before window creation, with some drivers #235

Closed
ccanepa opened this issue Feb 13, 2015 · 2 comments
Labels

Comments

@ccanepa
Copy link
Contributor

ccanepa commented Feb 13, 2015

error 'cannot share context' while import cocos.particle_systems before calling director.init

seen in mailing lists:
https://groups.google.com/forum/#!topic/cocos-discuss/zg1_Xd7hG6A
https://groups.google.com/forum/#!topic/pyglet-users/44pS-xkoObI

Narrowing the issue by the OPs:

Daniel Gillet:
After some investigation, I found the culprit. It's in particle.py, at line 174:
pic = pyglet.image.load('fire.png', file=pyglet.resource.file('fire.png'))

This is a class attribute, and gets executed at import, before director.init() had a chance to run. Still it's annoying that I need to initialize the director before loading images like this as class attributes.
...
It's actually not pyglet.image.load but texture = pic.get_texture() which is causing problem.
...
(Error seen with IWin 7, py27 or py34, gpu Intel HD Graphics4000 using either pyglet 1.2rc 1 or pyglet 1.2.0 release. )

@ccanepa
Copy link
Contributor Author

ccanepa commented Feb 27, 2015

lazy loading added in commit c986a04.

Notice the window should be created before instantiating the particle class.

@ccanepa ccanepa closed this as completed Feb 27, 2015
@ccanepa ccanepa added the bug label Feb 27, 2015
@dangillet
Copy link
Contributor

For info, this kind of problem ('Unable to share context') will be soon fixed in Pyglet. See discussion here: https://groups.google.com/forum/#!topic/pyglet-users/44pS-xkoObI

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

2 participants