Selected edges always in front

That’s why GL_LEQUAL or GL_EQUAL doesn’t work. As you are using different primitives to draw your edges, there is no invariance guaranteed.

wSpace,

Why this approach should work only for thickness bigger than one? The edges thickness is a parameter in our app and can be even one.

Thanks,

Alberto

Imagine that your selected line width is set to 2. When a line is drawn between two vertices, half the line overlaps the selected side and the other half is off of the side. Because the line only draws where the stencil buffer is set to 1, which is where the selected side is, you will only see half of the line; it would appear that the line is one pixel wide.

My thought was that if you tell OpenGL that you want a line width of 1, you would see a line width of 0.5, which might look broken up.

This really isn’t a problem. If the user wants to see a line width of 1, you really tell OpenGL that you want a line width of 2. You just double the user’s preference.

The best thing might be to try out this technique to see if the visual quality is what you’re looking for.

Hello Alberto,

http://i34.tinypic.com/2jdhop5.png

Here I’m overdrawing selected edges with GL_LEQUAL. The trick is that selected and non selected edges are specified with the same primitive (GL_LINES) and with the vertices in the same order. That way OpenGL produces exactly the same depth values for the fragments, and the depth test, with GL_LEQUAL (could be GL_EQUAL aswell) passes.

So in a first pass I draw polygons (GL_TRIANGLES) with polygon offset. Then I draw all edges (and vertices).

After I overdraw selected edges with GL_LEQUAL but GL_EQUAL should work too.

The reason of why I use GL_LEQUAL is that I GL_LEQUAL all the time to allow for multiple passes.

Thanks wSpace,

I will try this approach ASAP.

Alberto

DandyYuyo,

Nice result, my best compliments. This is exaclty what we are trying to achieve. BTW I can use it because we use different approached to draw edges.

Alberto