Dash line in wireframe after fill polygon

After fill polygons, I use GL_LINE_LOOP to draw a wireframe on these polygons. Some of the lines in the wireframe will be dashed, but other lines are still solid. If don’t fill polygons, all the lines in the wireframe will be solid. If turn on GL_LINE_SMOOTH flag or just set line width to 2.f, then all lines in the wireframe will be solid, no matter whether fill polygons or not. But a wireframe with wider line width looks not good.
Can anybody help me with this issue? Thank you very much.

What you are seeing is depth fighting. The lines are trying to go exactly where the surface is.

Try this:

draw solid polygons...


draw the same polygons again.


You can skip the polygon mode stuff and just draw line segments, as you are doing now. Have a look at the Polygon Offset section of the Red Book.

Yeah, of course we can help :slight_smile:

Looks like you should use glPolygonOffset (I think it is, if not, its glPolyOffset…) Anyways, you offset your polygon by a positive value, and your lines will stand out nicely.

The above suggestion works nicely if you don’t mind drawing your lines as a polygon, and not as GL_LINE_LOOP.