Question

I am programming a code in OpenGL in which I want to draw a line over another. The first drawn line should disappear but instead there is interference between them.

Image that illustrates this:

   Diagram

Is there anything I can do to solve this?

Was it helpful?

Solution

Polygon Offset will do that (sample code). Remember that you must enable GL_POLYGON_OFFSET_LINE in addition to calling glPolygonOffset (as explained on the linked manpage).

If these are actually drawn using GL_LINES, then as pointed out by Andon M. Coleman, this will not work. In that case, use glDepthRange to a similar (almost identical effect).

How to do that is explained on the OpenGL FAQ #13.050.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top