[vtkusers] Writing Postscript files from VTK

Carl Hetherington lists at carlh.net
Tue Oct 1 08:32:39 EDT 2002


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);
    window->Render();
    state = gl2psEndPage();
  }

  fclose(fp);

Unfortunately this gives me zero-sized EPS files, with gl2ps saying
"GL2PS warning: Empty feedback buffer".

Can anyone show me how it is done?

Thanks in advance,
Carl






More information about the vtkusers mailing list