Hello,
Sorry to dig out this old issue. But I ran in the very same problem on my
laptop, though it works fine on my desktop.
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.
Claudio wrote : "*I would expect all the four cases to crash if sharing
Open GL contexts are not supported by your gpu drivers, (because by default
pyglet builds a hidden window that will share context with all the windows
created by pyglet window.Window)*"
So I will now try to figure out what pygelt does when calling
pyglet.image.load. If someone with more experience with pyglet can point me
in the right direction, I'll appreciate. I'll get back to you if I find
anything...
Daniel.
Le lundi 1 avril 2013 14:23:41 UTC+2, Qasim Khalil a écrit :
>
> When I try to import cocos.particle_systems I get the following
> exception pyglet.gl.ContextException: Unable to share contexts.
>
> I do not even use any code from the import or anything else involving
> particle systems, I simply import the module and then I get this exception.
> I even had a look at the code in particle_systems.py and I couldn't find
> anything that would cause this. I further tried to block the import of
> particle.py from there but for some reason that had zero effect.
>
> The full error is:
>
> Traceback (most recent call last):
>> File "run_game.py", line 10, in <module>
>> main.main()
>> File "main.py", line 211, in main
>> director.init(width=1280, height=720, caption="Planet Eater")
>> File
>> "C:\Python27\lib\site-packages\cocos2d-0.5.5-py2.7.egg\cocos\director.py",
>> line 295, in init
>> self.window = window.Window( *args, **kwargs )
>> File "C:\Python27\lib\site-packages\pyglet\window\win32\__init__.py",
>> line 131, in __init__
>> super(Win32Window, self).__init__(*args, **kwargs)
>> File "C:\Python27\lib\site-packages\pyglet\window\__init__.py", line
>> 559, in __init__
>> self._create()
>> File "C:\Python27\lib\site-packages\pyglet\window\win32\__init__.py",
>> line 261, in _create
>> self.context.attach(self.canvas)
>> File "C:\Python27\lib\site-packages\pyglet\gl\win32.py", line 263, in
>> attach
>> super(Win32ARBContext, self).attach(canvas)
>> File "C:\Python27\lib\site-packages\pyglet\gl\win32.py", line 208, in
>> attach
>> raise gl.ContextException('Unable to share contexts')
>> pyglet.gl.ContextException: Unable to share contexts
>
>
--
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 http://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.