PDA

View Full Version : How to hide the backside of the GL_LINE



renaissance1975
06-16-2010, 04:27 PM
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

david.garcia
07-13-2010, 03:56 PM
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).

renaissance1975
07-13-2010, 04:17 PM
Thanks. That is what I did later on to solve this problem.