wired facets

HI,
I’m using OpenGL to draw math
3d plot and I need to add
“wired facets” mode.
I tried everything but
wires are every time “dotted”
but I need solid lines!

Thanx

So you try to make a wireframe mode? Setting rendermode to GL_LINES or so and disabling textures is an easy way to achieve that.

…yes…but I forget to write
that I need hidden face removal!!

Then do your hidden surface removal and then draw the wireframes. Or was your question on how to do hidden surface removal?

Draw the object in normal polygon drawing mode with the color buffer masked off, so it only shows up in the depth buffer. Then enable GL_POLYGON_OFFSET_LINE and call glPolygonOffset(-1.0, -1.0). Set the polygon draw mode to GL_LINE, and draw it with the depth function set to GL_LEQUAL. That should work.

If you get artifacts, try playing around with the values in glPolygonOffset().

j

Just wondering… what happens if you skip the polygon offset and draw the lines with a depth function of GL_EQUAL? Anybody tried this?

Hello

Maybe this will work, never tried…
Use textured quads. The textures left and top edge should be white and the rest black. I don’t mean that the texture should have edges though (ie. the size should be 2^x and not 2^x+2). Just use depth-testing and it should look like a wireframe.

Osku

Just wondering… what happens if you skip the polygon offset and draw the lines with a depth function of GL_EQUAL? Anybody tried this?

I haven’t tried it, but because video cards rasterize polygons differently depending on the drawing mode, you will probably get a whole lot of “popping” with the lines being visible in in some places, and not visible in others, due to depth buffer inaccuracies. It works if you don’t change the drawing mode.

Hello

I meant that the texture shouldn’t have borders, sorry…

Osku

Originally posted by MikeC:
Just wondering… what happens if you skip the polygon offset and draw the lines with a depth function of GL_EQUAL? Anybody tried this?

Hi Mike !

I did that when I first tried to do what Dave007 describes… As j said, you have a lot of “popping”… The only way I found was to use the polygon offset (which works pretty damn well by the way !).

Regards.

Eric