I want to render the outlines + creases with opengl but it's not going as I wish. Can someone, please help me to solve this problem? So far the outline it's rendered like this.
At this moment what I'm doing is: Frist I do this:
GL.Enable(EnableCap.PolygonOffsetFill);
GL.PolygonOffset(0, -1f);
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
GL.DepthFunc(DepthFunction.Lequal);
GL.DrawArrays(PrimitiveType.Triangles, 0, verticesList.Count);
GL.Disable(EnableCap.PolygonOffsetFill);
Then I render again like this:
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
GL.LineWidth(5f);
GL.DepthFunc(DepthFunction.Less);
GL.DrawArrays(PrimitiveType.Triangles, 0, verticesList.Count);
I want to render those green lines as well:
The wireframe over the filled shape looks like this:
Thanks in advance!




You cannot achieve this with
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);. ThePolygonMode.Linemode does not render the outlines of the mesh, but the outlines of the primitives (triangles). There is no feature that will give you what you want right away. If you want to draw these lines on a solid mesh, you need to disable the depth test and create a separate geometry with Line primitives. You can use the same vertex coordinates for this geometry, but you must draw them in a different order. OpenGL is just a low-level API implemented by the graphics driver that gives you access to the GPU, but it's not a render, game, or CAD engine. You have to implement the engine and you can do it with OpenGL.