Re: [PyOpenGL-Users] How do I get the window/widget id of an OpenGL drawing area?
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@ro...> - 2005-07-30 13:31:05
|
Silverstein wrote: > I have an application written in c++ and motif which draws into a 3D > Workspace using OpenGL. I'd like to be able to use PyOpenGL to draw > into this same window. To do this I need to be able to specify to > PyOpenGL which window is the drawing window. Actually, I think you'll find that's a fairly involved way to go about it. > I think I can manage to get the window/widget id back to python by > providing some python accessor functions which will allow my python > app to get this info. What is not clear to me is what function(s) > would I call to set the buffer appropriately. > > Typically we call glXSwapBuffers in our c++ app, but I don't see any > glx* functions in PyOpenGL. Right, those functions are called by the GUI library's OpenGL widget. > What module and/or functions can I use to do this? > > Any pointers, suggestions would be much appreciated. In your C++ code, set the current GL context, then call the PyOpenGL code. When you want to do a glx-level function, return control to your application, either by returning from your PyOpenGL function, or by providing a wrapped method to your code that calls whichever piece of code you want to trigger. PyOpenGL renders to the current rendering context of the process (as does all OpenGL), so you don't need to do anything special for connecting it to your widgets. The only time you need the special code is when you want to make the window manipulations themselves (glx calls) from Python. If you really do want the window manipulation to happen in Python, you can look at the source code for PyGame's GL widget, or the Togl source-code, which are just encapsulations of the platform APIs for use by Python (or TCL). HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |