How to hide the backside of the GL_LINE

I am drawing one surface on the current scene. Then on the suface, I draw a line with normal the same as the surface but different color. Then I rotate the two targets at the same time. I used
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glEnable(GL_DEPTH_TEST);

So when the surface is rotating, it only shows me the front face. However, the line is still there when it rotated to the far side with a black line. I am wondering how to hide this line when it is rotating away with its back side. I think the depth buffer will handle this if there is something infront of the line. But it is not working in my case.
Thank you very much,
Renaissance

GL lines don’t have front and back faces. You would need to either cull the lines yourself in the CPU or tesselate them (i.e. transform them into polygons).

Thanks. That is what I did later on to solve this problem.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.