[gl2ps] problem with hidden surfaces

Denis Roegel Denis.Roegel at loria.fr
Wed Mar 2 23:27:23 CET 2005


Hi,

I am doing experiments with the GL2PS library, which is great, but I am
sometimes running
into problems. For instance, the following is an example output

  http://www.loria.fr/~roegel/tmp/tmp.ps

of a scene where the dodecahedron is actually behind the sphere.
The long tetrahedron penetrates the sphere, but in the PS output
it appears in front of it. Moreover, an arc of the sphere edge
is visible crossing one of the edges of the dodecahedron.

Did I make something wrong or have I forgotten an option?
I have included gl2ps.h and I am working under linux.

I am using the latest gl2ps (1.2) and my save_ps function looks like
this

void ps_save() {
  FILE *fp=fopen("tmp.ps","wb");
  GLint buffsize = 0,state = GL2PS_OVERFLOW;
  GLint viewport[4];

  glGetIntegerv(GL_VIEWPORT,viewport);

  while (state == GL2PS_OVERFLOW) {
    buffsize += 1024*1024;
    gl2psBeginPage("MyTitle", "MySoftware",viewport,
                   GL2PS_EPS, GL2PS_BSP_SORT,
                   GL2PS_SIMPLE_LINE_OFFSET | GL2PS_SILENT |
                   GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT |
GL2PS_NO_TEXT,
                   GL_RGBA, 0, NULL, 0, 0, 0, buffsize,
                   fp, NULL);
    draw_scene();
    state = gl2psEndPage();
  }

  fclose(fp);
  fp=fopen("tmp.tex","wb");
  buffsize = 0;
  state = GL2PS_OVERFLOW;
  while (state == GL2PS_OVERFLOW) {
    buffsize += 1024*1024;
    gl2psBeginPage("MyTitle", "MySoftware",viewport,
                   GL2PS_TEX, GL2PS_BSP_SORT,
                   GL2PS_SIMPLE_LINE_OFFSET | GL2PS_SILENT |
                   GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT,
                   GL_RGBA, 0, NULL, 0, 0, 0, buffsize,
                   fp, NULL);
    printf("(1)");fflush(stdout);
    draw_scene();
    state = gl2psEndPage();

  }

  fclose(fp);

}

This involves only simple shapes, so I assume that the hidden faces
removal should work. I am also running into problems with more
complex shapes, such as tessellated polygons.

Thank you very much in advance if you can help me.

Denis Roegel
LORIA
Nancy France