[vtkusers] Writing Postscript files from VTK

Carl Hetherington lists at carlh.net
Thu Oct 3 12:21:45 EDT 2002


On Tue, 1 Oct 2002, Melvin Hadasht wrote:

> 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.

Thanks for the reply.  Seems to be working today, so perhaps it was me not
checking the file pointer... idiot that I am.

Thanks

Carl




More information about the vtkusers mailing list