Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

backface culling of lines?

139 views
Skip to first unread message

sho...@gmail.com

unread,
Apr 11, 2006, 3:49:02 PM4/11/06
to
I have a scene made of several logical objects, each made of several
polygons.
what I'm trying to do is to draw the objects of the scenes and then to
be able to make the outline of one of them show up infront of the whole
scene.
I found that one way of doing this is drawing the scene, then clearing
the depth buffer and then drawing the outline I need. this is just
almost my desired effect. The problem however with this method is that
actually the "outline" I'm drawing is made of actual lines drawn with
GL_LINES and not polygons drawn with glPolygonMode= GL_LINE. so what
I'm seeing is a mix of all the lines of the objects, including the ones
that are suppposed to be hidden.

drawing the lines using polygons is not an option since the objects I'm
drawing are concave and so are the outlines I need.
so my question is, is there any way to achieve the functional
equivalent of backface culling with GL_LINES? or is there any other way
to achieve the effect I described using stencils or whatnot?

Gernot Frisch

unread,
Apr 18, 2006, 3:25:48 AM4/18/06
to

> drawing the lines using polygons is not an option since the objects
> I'm
> drawing are concave and so are the outlines I need.
> so my question is, is there any way to achieve the functional
> equivalent of backface culling with GL_LINES? or is there any other
> way
> to achieve the effect I described using stencils or whatnot?

Well, a "line" does not have a normal vector, thus not front/back.
However, you know the triangles at these edges, thus you you know a
"normal vector" to your line. Then you can draw only the lines that
are visible.

Usually you do this:
Draw the solid object.
Do some polygon offset (optional, but looks better)
Draw the object as GL_LINES (keep depth testing enabled)
The solid triangles at first "hide" your back-facing lines then.

jbwest

unread,
Apr 18, 2006, 9:59:19 AM4/18/06
to

"Gernot Frisch" <M...@Privacy.net> wrote in message
news:4ajiffF...@individual.net...

So why exactly can't you draw the lines as line-mode polygons? If they are
concave, use the tesselator. The above technique won't necessarily hide
backfacing polygon edges.

For the record, lines can have normal values (OpenGL normals are a property
of vertices, and don't have to have anything to do with geometry).
Backface/frontface has nothing to do with *vertex* normals, though, only the
winding order of the vertices of a polygons.

-jbw


0 new messages