save an opengl canvas (wxPython)

Z

Zunbeltz Izaola

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

--
Zunbeltz Izaola Azkona | wmbizazz at lg dot ehu
dotes
Materia Kondentsatuaren Fisika Saila |
Zientzia eta Teknologia Fakultatea | Phone: 34946015326
Euskal Herriko Unibertsitatea |
PK 644 | Fax: 34 944648500
48080 Bilbo (SPAIN) |
 
M

Mike C. Fletcher

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 said:
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
 
Z

Zunbeltz Izaola

Mike C. Fletcher said:
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

Hi Mike,

Thanks for the answer. I'll check the code. For the moment png or jpeg
is ok, but maybe in the future i'll like to save the image as
postscript to use it with LaTeX font and so on. I've se the gl2ps
library and the last version is 21 September 2004. Can you send me
the SWIG file? I don't know much about swig and it would be easier
to start with a file that has work in same older version.

Thanks again

Zunbeltz



--
Zunbeltz Izaola Azkona | wmbizazz at lg dot ehu
dotes
Materia Kondentsatuaren Fisika Saila |
Zientzia eta Teknologia Fakultatea | Phone: 34946015326
Euskal Herriko Unibertsitatea |
PK 644 | Fax: 34 944648500
48080 Bilbo (SPAIN) |
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

threads and exception in wxPython 24
handle a log file. 3
Using ConfigParse 5

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top