save an opengl canvas (wxPython)

Mike C. Fletcher mcfletch at rogers.com
Tue Dec 14 20:35:05 CET 2004


There's sample code in PyOpenGL and OpenGLContext for saving canvases to 
PNG or JPEG formats using PIL.  Saving to Postscript requires 
considerably more work (if you're implying saving as triangles, lines 
and the like).  There is a GPL library which lets you do this, and I 
have an old SWIG wrapper for it sitting around somewhere (I think, 
haven't touched it in years), but even then, it's fairly poor quality 
compared to capturing a bitmap image.

Anyway, the function for reading a buffer is glReadPixels:
    http://pyopengl.sourceforge.net/documentation/manual/glReadPixels.3G.xml
see the end of that man page for pointers to Python sample code.

Good luck,
Mike

Zunbeltz Izaola wrote:

>Hi,
>
>I've a drawing made in an OpenGL canvas. I want to save it to a file
>(preferibly PostScript format). Somebody knows how to do it?
>
>TIA
>
>Zunbeltz
>  
>
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com




More information about the Python-list mailing list