views:

293

answers:

1

I've recently started playing with pycairo - is it easy enough to render this to an pyopengl surface (e.g. on the side of a cube?)... my opengl is really non-existant so I'm not sure the best way to go about this.

A: 

This procedure might work:

  1. Do your drawing in pycairo like normal.
  2. Export the image to a file (or get a handle to it in memory).
  3. Load the image into opengl texture memory.
  4. Draw your cube in opengl using the texture.

Steps 1&2 are in cairo, which I'm not familiar with. Steps 3&4 would be done in opengl. There's a tutorial on drawing textured surfaces at NeHe with a link to a python version at the bottom.

scompt.com
I've learned a bit more about cairo + opengl now.Definitely rendering the image to an intermediate file is not the way I'd want to go (not exactly realtime).I've managed to do this in pyglet, but not with plain opengl and python.Any pointers on getting it to work with plain pyopengl and pycairo would be great...
Stuart Axon