On Fri, Mar 27, 2009 at 3:46 AM, Bruce Smith <[email protected]> wrote:

> I think at this point it makes sense to wait for Alex or Richard to
> weigh in....

Ok.  I'm pretty sure other developers have successfully done this with
either Qt or wxWidgets in the past, and discovered all the relevant
hacks required.  It's worth searching the group archives.

Anyway, there are three possible ways you might want to get pyglet
rendering into another toolkit's window.

1. Let the toolkit create the OpenGL context, and trick pyglet into
using that context without creating its own.

2. Let the toolkit create the platform window, and trick pyglet into
creating a context for that window.

3. Let the toolkit create a container for the window, and trick pyglet
into creating a child window with a GL context within that container.

It sounds like you want (1), and it's probably the easiest.  The main
issue is getting pyglet to believe there is already a valid context
bound.  Disable the shadow window, because you won't be needing it.
Then set a mock context object for pyglet.gl._current_context (you'll
have to write the class for this mock object yourself).

FWIW, (2) is what the wxtest.py code attempts to do.  It has the
benefit of allowing you to use pyglet's context configuration, and get
OpenGL 2.1 contexts with multisampling, etc.

(3) would let you use pyglet's event handlers for the GL window, but
would probably only be possible on Windows (just set WS_CHILD style
and parent it to the container's hwnd).

These are all very much hacks because integration with other toolkits
was never a design goal of pyglet (in the original discussions Richard
and I shared, I don't think it was even brought up as a possibility!).
 I made some headway into refactoring the context, window and a new
canvas class in pyglet-1.2dev (SVN trunk), but this is not in a
releasable state.

Alex.

--~--~---------~--~----~------------~-------~--~----~
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