I can't post images because I don't have enough reputation, so only links are provided.
I'm using OpenTK to render a 3D model (importing it works fine). The model was made in sketchup and the edge lines are also exported. When I try to render it, the lines are drawn over all of the polygons, even if they should be behind and therefore invisible. I have deduced that this is probably due to calling GL.End() and then switching to line mode and (probably) rendering over the existing image.
Is there a way to have both lines and triangles rendered simultaneously (with correct depth and overlap)? If not, how should I draw the lines? Can I draw them as triangles?
In my renderer: https://i.stack.imgur.com/oC9Ux.png
In sketchup(how I'm trying to make it look): https://i.stack.imgur.com/Jmu1S.png
My rendering code (world is the imported collada data, geometryLines are the lines being rendered and the triangles are the triangulated faces).
GL.Begin(PrimitiveType.Triangles);
GL.Color3(Color.Red);
GL.Enable(EnableCap.LineSmooth);
GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest);
foreach (Triangle tri in world.triangles)
{
GL.Vertex3(tri.vertices[0]);
GL.Vertex3(tri.vertices[1]);
GL.Vertex3(tri.vertices[2]);
}
GL.End();
GL.Begin(PrimitiveType.Lines);
GL.Color3(Color.Blue);
GL.Enable(EnableCap.LineSmooth);
GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest);
foreach (GeometryLine line in world.geometryLines)
{
GL.Vertex3(line.vertices[0]);
GL.Vertex3(line.vertices[1]);
}
GL.End();
SwapBuffers();