Overlapping lines

Hi All,

If you draw two triangles with different color and an edge in common you’ll see that edge animation during model rotation because one goes in front of the other randomly.

Is there any trick to minimize this issue without writing 1000 lines of code?

Thanks again,


It’s not exactly clear what you are trying to do! Do you draw the triangles in wireframe?

Well, as you certainly know, what you observe is called z-fighting.

The only way to avoid this altogether, is to not use the z-buffer, at all, and render the triangles in such an order, that you get the desired result.

That can be achieved, by using a BSP-Tree, though it will take roughly 1000 lines of code.

In the end, to answer your question: No, there is no way to do it, without some (much) work.

The problem is, that you render two edges, that are identical (except for their color), so, what do you expect the final result to be?? First you should decide, what you actually want, and only then you can start to think about how to get that result.

And, you should definitely try to put a bit more effort into your postings, because otherwise people can’t really help you (also that’s a good way to rethink your problem once again, and sometimes that’s enough to find solutions yourself).


Thanks Jan,

I thought it could exist a solution using blending. Maybe setting alpha at 90% the two lines colors could be blended together and reduce the z-fighting issue.

Thanks again,