I’m trying to use Panda3D in combination with pyGTK implementing a Panda3D-widget. I want this widget to be usable like a normal widget implemented with pyGTK.
My current approach is to integrate the taskMgr.step() method of Panda3D with the gtk main loop and positioning the gtk window above the Panda3D window. This approach only works on a fairly recent X window system with a compositing manager, because I have to make the gtk window at the widget area transparent.
Unfortunately, the Panda3D-pyGTK-combination makes my X server crash occasionally. Additionally, this approach does not work on windows.
So, I am wondering if there is a way in Panda3D for making the main window invisible and export the window contents to some kind of byte array or something like that which I can use to create a gtk.gdk.PixBuf and draw it onto my widget.
For everyone interested, my code sample can be found at dl.dropbox.com/u/995019/Panda3DWidget.py.gz
I am not sure, but i think there should be something like render to texture, i think there is even a sample of that.
thanks for that hint. It lead me directly to panda3d.org/reference/python … MImage.php to a gtk.gdk.Pixbuf
getScreenshot() is probably not fast enough to run every frame. You will be better off using render-to-texture instead, using something like this:
tex = Texture('tex')
And then extracting the data each frame with tex.getRamImage().getData()
and use getRamImage to extract the data?
Yeah, that’s exactly what drwr said.
Also note getRamImageAs, that can return the ram data in a specific component order.
should finish reading before trying full of enthusiasm
do you have a working code now?
i tried to do want you were speaking about but didn’t find how to apply on drawingarea.
my code is here https://discourse.panda3d.org/viewtopic.php?t=8856
see you later
At the moment I stopped working on the code because of lack of time.
I used the drawable.draw_rgb_image(gc, x, y, width, height, dither, buffer, rowstride) (see panda3d.org/reference/python … d6e2452297). Unfortunately this was really slow.
So, my new approach is to use the OpenGL-extension for GTK (see personal.redestb.es/jmovill/open … in-21.html). Maybe this is fast enough for drawing the RamImage of the panda texture on a GTK widget. I don’t have any code for this - only the idea
hope it helps,