Saving PyOpenGl figures as ps

Mike C. Fletcher mcfletch at vrplumber.com
Sun Feb 11 23:44:03 EST 2007


Frank wrote:
> Hi,
>
> I installed pyopengl (opengl for python) on my linux box and
> everything works fine. But now I want to save the generated images as,
> e.g., ps or eps. How can I do that and how can I adjust the resolution
> (if necessary)? This is probably simple but for some reason I can not
> find out how to do that.
>
> I appreciate every hint!
>
> Thanks, Frank
>   
Hi Frank,

Take a look at the demos in OpenGL, particularly:

    OpenGL-ctypes/OpenGL/Demo/GLUT/tom/conesave.py

which is a little GLUT application that renders into a GLUT windows and 
then allows you to save it. That's raster operation though (i.e. 
produces a PNG or JPG).  Raster operations can only save a portion of 
the screen as rendered, so if you want a higher resolution image you 
need to make a larger window.  If you want to get more advanced you can 
try using an off-screen buffer (pbuffer or MESA) for the rendering, 
which may (depending on implementation) allow for higher resolutions.

If you want a true vector graphic (PS, EPS) you'll need to use something 
like GL2PS.

    http://www.geuz.org/gl2ps/

HTH,
Mike

-- 
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com




More information about the Python-list mailing list