Using Cairo in Panda

Hi all, it’s been a while.

I have been hacking around in python-clutter land, trying to round-hole the square peg. It seems all the toolkits I have looked at just fall-short of the things I need in one place.

I am looking for a way to bring Cairo (and thus rsvg) into the realm of 2.5D and 3D.

Clutter is really neat … but a) There is almost no feedback or support to be had online, b) The python bindings lag way behind the latest development. These things leave me scratching my head for hours and days, poking at arcane API commands and throwing the bones to get stuff done.

I just saw the first real mention of cairo on this thread: [Treeform's feature requests)
In there is a Star Trek technobabble-like glimmer of hope (to dim-bulbs like me):

There is also some code there. So, what I am asking in this thread is for working examples of a cairo surface in Panda.

I want to be able to ‘zoom’ in on a node (a 2d plane for now) such that the texture can be redrawn at each step so that it remains “high res.” (Think Inkscape written in Panda3D.)

Any hope?


I don’t have Cairo installed, so I can’t easily put together an example; but I don’t know what’s wrong with the code in the linked thread. The basic idea is to allow Cairo to do its rendering into a memory buffer, then use setRamImage() or one of its variants to copy that memory buffer into a texture. Then you can apply that texture to a card or whatever and render it in-game wherever you want.


I confess I have not tried that code, I was put-off by the message saying it did not work.

I have been distracted again (damn you clutter :slight_smile: ), so will return once I have actually tried to render cairo via Panda.

Just for the record: if Panda could integrate SVG (the rendering thereof onto Textures, and as ‘geometry’ alá lines and ropes) it would open a new world of possibilities, taking it from a ‘game’ engine into a much more sophisticated ‘media’ engine — I keep thinking of something as flexible as Flash, combined with 3D.


Hum, Panda3D is really not built for that sort of thing - but if you want to go ahead and integrate OpenVG, no-one is stopping you.