On 3/9/08, selsine <[EMAIL PROTECTED]> wrote: > > Hi Eveyone, > > First off I have to say that I'm not a PyGlet or Open GL expert, but I > am looking into using PyGlet for my future "game" code. > > One of the things that I have been looking at is the possibilities of > using PyGlet in a PyGTK application to serve as a level editor. I've > been looking through the archives and from what I understand this is > possible. I know that I won't have access to the event loop, but since > this is for an editor it wouldn't matter. > > The reason I want to use PyGlet, instead of anther OpenGL module, is > because the level editor would be for an eventual PyGlet game so I > would like to reuse and share as much code as possible (i.e. use the > PyGlet 1.1 sprites in both_ > > I can create a GL Context in a PyGTK window, and according to one post > that I read what I need to do is "trick" PyGlet into using this GL > context. > > So my questions are: > > 1) How would I trick PyGlet into using the GL context that I have > already created
There's actually no trick... OpenGL has only one active context at a time. In pyglet you can switch contexts with Window.switch_to(). When you create a new window the context will switch to that window automatically. If you never call switch_to() or create a new window, the context never changes; so the PyGTK one remains active. The situation could get a lot more complicated if you're using more than one PyGTK window (context), or trying to mix pyglet windows with PyGTK windows. In pyglet 1.1 you should also set pyglet.options['shadow_window'] to False. > > 2) How feasible is the idea of a PyGlet level editor in a PyGTK > application? I can't foresee any problems if you stick to just one PyGTK window. 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 -~----------~----~----~----~------~----~------~--~---
