intermittent 'GL context' error

266 views
Skip to first unread message

damien.j...@gmail.com

unread,
Jul 10, 2015, 11:09:28 PM7/10/15
to pyglet...@googlegroups.com

Hi all,


I'm having an intermittent problem with pyglet - importing 'pyglet.gl' sometimes gives the following:


----

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/damien/venv/pyglet_test/lib/python2.7/site-packages/pyglet/gl/__init__.py", line 236, in <module>
    import pyglet.window
  File "/home/damien/venv/pyglet_test/lib/python2.7/site-packages/pyglet/window/__init__.py", line 1817, in <module>
    gl._create_shadow_window()
  File "/home/damien/venv/pyglet_test/lib/python2.7/site-packages/pyglet/gl/__init__.py", line 205, in _create_shadow_window
    _shadow_window = Window(width=1, height=1, visible=False)
  File "/home/damien/venv/pyglet_test/lib/python2.7/site-packages/pyglet/window/xlib/__init__.py", line 166, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/home/damien/venv/pyglet_test/lib/python2.7/site-packages/pyglet/window/__init__.py", line 516, in __init__
    context = config.create_context(gl.current_context)
  File "/home/damien/venv/pyglet_test/lib/python2.7/site-packages/pyglet/gl/xlib.py", line 186, in create_context
    return XlibContextARB(self, share)
  File "/home/damien/venv/pyglet_test/lib/python2.7/site-packages/pyglet/gl/xlib.py", line 300, in __init__
    super(XlibContext13, self).__init__(config, share)
  File "/home/damien/venv/pyglet_test/lib/python2.7/site-packages/pyglet/gl/xlib.py", line 203, in __init__
    raise gl.ContextException('Could not create GL context') 
pyglet.gl.ContextException: Could not create GL context
----

It doesn't happen every time - seems to be about 50% (but not in any discernable sequence). It occurs across multiple computers with the same Nvidia card, but not on my laptop with an (older) ATI card.


This is on linux (Arch) with nvidia drivers. My video card is 'NVIDIA Corporation GK107 [GeForce GTX 650] (rev a1)'. My version of pyglet is '1.2.3' (installed via pip) in an otherwise clean virtualenv. It is reasonably new behaviour - it has been working fine up until the last month or so.


Does anyone have any ideas on what might be going on, or how to get more information on the error?


Thanks!

Rob

unread,
Jul 11, 2015, 6:06:48 AM7/11/15
to pyglet...@googlegroups.com
Hi,

You can try enabling GL tracing to see which GL calls cause errors while creating the context. Try adding the following at the start of your application:

import pyglet
pyglet.options['debug_gl_trace'] = True

Optionally you can also add
pyglet.options['debug_gl_trace_args'] = True

Rob

Op zaterdag 11 juli 2015 05:09:28 UTC+2 schreef damien.j...@gmail.com:

Damien Mannion

unread,
Jul 12, 2015, 6:42:25 PM7/12/15
to pyglet...@googlegroups.com
Hi Rob,

Thanks for your reply. I have tried enabling the option you suggested. When the import is successful, I get a series of mostly 'glGetStringi'. When the import is unsuccessful, I immediately get the ContextException and no debugging info appears.

I have done a bit more investigating and it seems like the problem is because 'glx_context_id' is being returned as a large negative number (e.g. -181426592, -1261185472), as opposed to a large positive number when it is successful. I'm not sure what this means though?

Cheers,

Damien.

--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/GqQ4LowmAOY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users...@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Rob van der Most

unread,
Jul 13, 2015, 1:13:22 AM7/13/15
to pyglet...@googlegroups.com

That probably means we are using a 64 bit pointer as a 32 bit pointer somewhere. Can you create an issue for this?

Rob

You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.

Damien Mannion

unread,
Jul 13, 2015, 2:19:55 AM7/13/15
to pyglet...@googlegroups.com
Thanks - issue created.

I also find that everything proceeds fine if I remove the negative glx_context_id check (i.e. it imports successfully and the program also seems to behave normally).

-damien
Reply all
Reply to author
Forward
0 new messages