This looks more like “Z-fighting” than “draw order” issues… and unfortunately, you cannot force a specific pixel to render over another one, when both occupy the exact same depth in the z-buffer…and which pixel “wins” is entirely up to the GL implementation.
The way Rhino tries to solve this type of problem is by “nudging” the z value either towards the camera or away from it, depending on what’s trying to be solved. This can be “attempted” by using the
SetZBiasMode(...) method on the pipeline… I would start by calling:
…prior to drawing the lines you want “on top”…
If that doesn’t solve it completely, you can try adding a number to the parameter…like so:
dp.SetZBiasMode(ZBM_TOWARDS_CAMERA + 1);
…but I wouldn’t go any further than +2, as it will most likely give your lines a “hovering” effect.
Also, you should make sure that you put the pipeline’s z-bias mode back to the way it was prior to setting it, otherwise, it can/will mess up other draws, and will most likely negate the effect you’re looking for… This is done like so:
int oldZBM = dp.ZBiasMode();
dp.SetZBiasMode(ZBM_TOWARDS_CAMERA + SOME_FUDGE_FACTOR);
However, if the objects you’re trying to influence are not your own (i.e. They’re just rhino objects being drawn by Rhino), then it may be harder to get the results you’re after… You would need to probably first prevent Rhino from drawing the wires, keeping track of which objects you’ve prevented wires for, then once Rhino has finished drawing, go back and draw the wires, but bias them towards the camera as I’ve shown above.
Without a complete understanding of what it is you’re doing, this is all speculation on my part… Chunks of working code, and possibly a plugin example that shows exactly what it is you’re doing, and what the expected results are, would help me not only see the exact problem, but it would help me show you what can be done or added to solve the problem…assuming it can be solved at all. Otherwise, pictures and descriptions of the problem and expectations are too wide open for interpretation, and we can just go around and around trying this, that, and the other…never landing on a solution.
Hope that makes sense.