Z-Buffering on wireframe

I have a normal scene and I want to render the polygons in wireframe instead of filled. Ok, so thats easy enough.

How can I set it up so that the “hidden lines”, or the outlines of polygons that are behind other polygons, are not shown?

I don’t think it’s possible since it is not able, think on it about the Z-buffer, it’s same thing. It doesn’t know you want to draw something more in the scene.

Enabling back face culling will delete some of them but i don’t think this is what you really want.

Cheers

Allan

If you a background behind the object that is a solid color, maybe you could set the color to the background color and render the object in the filled mode. Then change the color and render the model in wireframe mode. You may want to use glpolygonoffset when rendering the object in wireframe mode.

Hope that helps…

Pat is on the right track here. But instead of setting the vertex color to the color of the background, disable writes to the frame buffer with glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FASE), and render only to the depth buffer. This way, the background can be seen through the wires, but all hidden wires will be removed.

Originally posted by Allan Walton:
[b]Enabling back face culling will delete some of them but i don’t think this is what you really want.

Cheers

Allan[/b]

I think Allan is correct and I think that is what you want. Just use glPolygonMode and enable backface culling. This will eliminate all your backface polygons so their lines will not be drawn.

If you want to eliminate all lines behind the object then you will have to generate edge flags on your own. glEdgeFlag.

If you dont want to see anything at all behind the object you could draw the object with polygon fill mode and then draw it again with line mode.