On Mar 26, 6:42 am, Crispin Wellington <[email protected]> wrote: > ... > Does anyone know what is this "shadow window" this code is referring > to? Needless to say, this snippet of code as it stands prevents being > able to use pyglet gl with QT without adverse effects.
There is some documentation for it in pyglet/__init__.py: #: Global dict of pyglet options. To change an option from its default, you #: must import ``pyglet`` before any sub-packages. For example:: #: #: import pyglet #: pyglet.options['debug_gl'] = False #: #: The default options can be overridden from the OS environment... #: #: The non-development options are: #: .... #: shadow_window #: By default, pyglet creates a hidden window with a GL context when #: pyglet.gl is imported. This allows resources to be loaded before #: the application window is created, and permits GL objects to be #: shared between windows even after they've been closed. You can #: disable the creation of the shadow window by setting this option to #: False. Recommended for advanced devlopers only. #: #: **Since:** pyglet 1.1 So, maybe it will be sufficient to modify this option before importing pyglet.gl, then run equivalent code (not sure what will be needed) before first using pyglet on the QGLWidget GL context. Looking for uses of shadow_window in the pyglet code: in gl.base.Context.destroy, it looks like it wants to switch back to that "shadow GL context" whenever destroying one of its own... more generally, that class looks designed to wrap a GL context so pyglet can use it -- maybe you'll need another way of creating one, to wrap an existing context? Looking in the documentation, it's also mentioned in pyglet-1.1.2-docs/doc/html/programming_guide/ creating_an_opengl_context.html but skimming that, I don't see anything about using a context and window created outside of pyglet. Glancing at the APIs in pyglet-1.1.2-docs/doc/html/api/index.html, it sure looks general enough to support multiple contexts, some sharing resources and some not, potentially from multiple sources (e.g. some Qt windows and some pyglet windows), but I still don't notice anything explicit about using contexts from non-pyglet sources. IIRC, that is a documented general limitation of pyglet, so maybe new code for creating a subclass or sibling class of Context would be needed to do that properly.... And I finally glanced at experimental/wxtest.py, but didn't study it closely (I don't have or know wxWindows). But it looks like it's mainly worried about *creating* a GL context in a different way, whereas all we want to do here is *use* an existing one, which ought to be easier. I think at this point it makes sense to wait for Alex or Richard to weigh in.... - Bruce --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
