[gl2ps] Re: Plot-application for gCAD3D

Christophe Geuzaine geuzaine at acm.caltech.edu
Tue May 4 23:40:18 CEST 2004

Franz Reiter wrote:

> Hallo
> your software gl2ps is very impressive. I am working on a similar problem
>  and so i would like to ask you about the following OpenGL-problem:
> I want to produce a plot of an OpenGL-3D-Object.
> The plot shall consist only of 2D-Lines of the visible edges of
>  the OpenGL-object (all hidden lines removed).
>  No colours and textures are wanted (this shall also be a tool for
>  3D to 2D drawing-conversion).
> The OpenGL-3D-Object consists of GL_LINES, GL_LINE_STRIP, GL_POLYGON;
>  (rendered triangles).
> What i have done till now:
>   i can produce a OpenGl-Image with hidden lines removed; OK
>   (i do this by using glStencilFunc - like demoprog hiddenline.c)
>   afterwards i read the result with GL_FEEDBACK; but the feedback-buffer
>   always provides all lines (even the hidden lines).
> MY PROBLEM: how can i get only the visible lines ?

This is hard: IIRC, the stencil stuff is applied after the creation of
the feedback buffer in the OpenGL pipeline (like the z-buffer sorting,
it's a per-pixel operation)...

I guess you could

- use the feedback buffer with both the lines and the polygons
- remove the occluded primitives using e.g. a 2D BSP tree
- only output the lines that remain after occlusion culling

This nevertheless requires that you perform all the necessary
subdivisions in the 2D tree--something we don't do at the moment in
gl2ps since we keep the non-occluded polygons anyway...



Christophe Geuzaine
Applied and Computational Mathematics, Caltech
geuzaine at acm.caltech.edu - http://geuz.org

More information about the gl2ps mailing list