PDA

View Full Version : wired facets



Dave007
12-03-2000, 07:34 AM
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

Michael Steinberg
12-03-2000, 09:31 AM
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.

Dave007
12-04-2000, 09:11 AM
...yes....but I forget to write
that I need hidden face removal!!

Michael Steinberg
12-04-2000, 11:26 AM
Then do your hidden surface removal and then draw the wireframes. Or was your question on how to do hidden surface removal?

j
12-04-2000, 12:37 PM
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

MikeC
12-04-2000, 12:42 PM
Just wondering... what happens if you skip the polygon offset and draw the lines with a depth function of GL_EQUAL? Anybody tried this?

Osku
12-04-2000, 02:33 PM
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

j
12-04-2000, 04:41 PM
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.

Osku
12-05-2000, 10:12 AM
Hello

I meant that the texture shouldn't have borders, sorry...

Osku

Eric
12-05-2000, 10:13 PM
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