On Sun, Apr 7, 2013 at 11:09 AM, <[email protected]> wrote:

> I've checked the environment variables and indeed I am not setting any
> pyglet options. I am using pyglet 1.2alpha1 and python 2.7.3.
>
>
Just in case I retested with pyglet 1.2alpha1, all runs ok here.


> With a fresh copy of my script:
> 1st run: all imports commented out - Runs OK.
> 2nd run: uncomment only ONE - Error
>
>> Traceback (most recent call last):
>>   File "cocostest.py", line 17, in <module>
>>     director.init()
>>
>>   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
>>
>
> 3rd run: uncomment only the first TWO - Runs OK.
> 4th run: uncomment only the second TWO - Runs OK.
>
> With your script:
> 1st run: both commented out - Runs OK.
> 2nd run: uncommented only #ONE - Runs OK.
> 3rd run: uncommented only #TWO - Runs OK.
>
>
>


Thats... surprising.

Comparing the second and third runs of your script:
   the third run explodes in the director.init call
   at this point the only difference in app state are the ones created by
the import cocos_particle_systems in the exploding script
   and what does that import ? It is equivalent to

       from particle import ParticleSystem, Color
       from euclid import Point2

because all other code is class definition, so no running at import time.
>From the point of view of side effects at import, thats equivalent
(replacing the first import) to:

import random
import pyglet
from pyglet.gl import *
import math
import copy
import numpy
import ctypes

from cocosnode import CocosNode
from euclid import Point2

forced_point_sprites = None
rand = lambda: random.random() * 2 - 1

All other lines are in class and func definitions, so no running at import

cocosnode.py has no side effects on imports, euclid does nothing openGL,
the last two lines don't change the openGL state.

In fact, the only lines looking as potential culprits to change GL state are

   import pyglet
   from pyglet.gl import *

I would expect then that my script, the one only involving pyglet, will
crash in the second run.

Yet your results tell otherwise.

And now what ?

  I suggest you double check that the second run with my script uncomments
only ONE and that it does not traceback ( yes, yes,  just in case)

If the results are the same (no crash) , the only way I can see to
investigate the issue is testing your script gradually commenting out code
in cocos.particle.py and see when it ceases to crash.

As I can not reproduce the issue I cant test by myself, sorry.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to