I found the culprit.

In pyglet/gl/__init__.py, right at the very end there is this devilish
looking piece of code.
----------------------
# Import pyglet.window now if it isn't currently being imported (this creates
# the shadow window).
if (not _is_epydoc and
    'pyglet.window' not in _sys.modules and
    _pyglet.options['shadow_window']):
    # trickery is for circular import
    _pyglet.gl = _sys.modules[__name__]
    import pyglet.window
----------------------
It seems to be caused by a bug here. If you remove this, the osx
version begins to behave the same way as the linux version, It ceases
to draw the scene and throws an exception like the linux one.

pyglet.gl.lib.GLException: No GL context; create a Window first

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.

Regards

Crispin Wellington


On Thu, Mar 26, 2009 at 2:45 PM, Bruce Smith <[email protected]> wrote:
>
> BTW, changing part of my modified version of your example as follows,
> I can confirm your earlier statement that importing pyglet.gl has a
> side effect (locking the window re dragging) which is not mediated by
> its redefinition of all the gl*/GL* globals:
>
> def _import_gl_raw(use_pyglet):
>    global glMultMatrixf, glClearColor, glShadeModel, glTranslated,
> glClear
>    global glColor3f, glLoadIdentity, glScalef, glVertex3f, glNormal3f
>    global glBegin, glEnd, glFlush, GLfloat, glViewport, glMatrixMode,
> glFrustum
>    global GL_TRIANGLES, GL_FLAT, GL_COLOR_BUFFER_BIT, GL_PROJECTION,
> GL_MODELVIEW
>    global glmult
>
>    if use_pyglet:
>        ## from pyglet.gl import *
>
>        from pyglet.gl import glMultMatrixf, glClearColor,
> glShadeModel, glTranslated, glClear
>        from pyglet.gl import glColor3f, glLoadIdentity, glScalef,
> glVertex3f, glNormal3f
>        from pyglet.gl import glBegin, glEnd, glFlush, GLfloat,
> glViewport, glMatrixMode, glFrustum
>        from pyglet.gl import GL_TRIANGLES, GL_FLAT,
> GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW
>
>        def glmult(l):
>               return glMultMatrixf( (GLfloat * len(l))(*l) )
>
>        ## pwin = pyglet.window.Window(resizable=True)
>
>    else:
>        ## from OpenGL.GL import *
>        from OpenGL.GL import glMultMatrixf, glClearColor,
> glShadeModel, glTranslated, glClear
>        from OpenGL.GL import glColor3f, glLoadIdentity, glScalef,
> glVertex3f, glNormal3f
>        from OpenGL.GL import glBegin, glEnd, glFlush, GLfloat,
> glViewport, glMatrixMode, glFrustum
>        from OpenGL.GL import GL_TRIANGLES, GL_FLAT,
> GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW
>
>        def glmult(l):
>                return glMultMatrixf( l )
>
> def _import_gl():
>    _import_gl_raw( 'PYGLET' in os.environ) # do the import pyglet.gl
>    _import_gl_raw( False) # then change the globals gl*/GL* back to
> what they were (bug still present on my Mac)
>
> - 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to