PDA

View Full Version : Z-Buffering on wireframe



kinslayer
12-04-2001, 08:01 AM
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?

svg
12-04-2001, 08:03 AM
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.

Allan Walton
12-04-2001, 08:51 AM
Enabling back face culling will delete some of them but i don't think this is what you really want.

Cheers

Allan

Pat
12-04-2001, 08:53 AM
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...

Bob
12-04-2001, 09:20 AM
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.

Kaycee
12-04-2001, 09:31 AM
Originally posted by Allan Walton:
Enabling back face culling will delete some of them but i don't think this is what you really want.

Cheers

Allan

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.