[vtkusers] Writing Postscript files from VTK

Melvin Hadasht melvin.hadasht at free.fr
Tue Oct 1 12:21:54 EDT 2002


Hi Carl,

on Tue, 1 Oct 2002 13:32:39 +0100 (GMT Daylight Time)
Carl Hetherington <lists at carlh.net> wrote:

 > Hi,
 > 
 > I'm interested in writing vector Postscript files of VTK renderings.
 > Consulting the mailing list archive suggests that gl2ps might be able to
 > do this.  I've tried the following example:
 > 
 > /* Set up a render window with a wireframe representation of a
 > ** vtkPolyData.
 > */
 > 
 > /* ... */
 > 
 >   FILE* fp = fopen("test.eps", "w");
 >   int buffsize = 0;
 >   int state = GL2PS_OVERFLOW;
 > 
 >   while (state == GL2PS_OVERFLOW)
 >   {
 >     buffsize += 1024*1024;
 >     gl2psBeginPage("Title", "Software", GL2PS_EPS, 0,
 > 		 GL2PS_SIMPLE_LINE_OFFSET, GL_RGBA, 0, NULL,
 > 		   buffsize, fp, NULL);

You should test for the return value of fopen. Maybe the problem was there.

I don't know the following may help or not, but in an old code I had the
filename also as the last argument of gl2psBeginPage{...char *filename; File *fp
= fopen(filename,"w");...;gl2psBeginPage(...,filename);...}. I can't remember
why I did that. 



Klahowya (Chinook: Goodbye)


-- 
Melvin Hadasht



More information about the vtkusers mailing list