What is the best way to draw outline of object using OpenGL?

What is the best way to draw outline of object using OpenGL?

Apart from your suggestions about the geometry shader, stencil buffer, and the previous answer’s edge detection methods, there are other methods which could work for you. Draw your object into a texture with a single color, which will be your outline color, blur it, and draw it behind your object. This will produce a smooth outline.

How to draw an outline of an object?

Draw your object into a texture with a single color, which will be your outline color, blur it, and draw it behind your object. This will produce a smooth outline. Just draw your object twice. The first time it is with a single colored shader which also extrudes vertices along the normal vector, and front face culling (keep the back faces).

How can I draw triangles twice in GL _ fill?

The solution appears to be to draw the triangles twice, once in solid black, using GL_FILL and once in color using GL_LINE. The problem with this approach is that, since I am using depth testing and the vertices are at the same position each time, my color lines end up blending with the black lines

How to create polygons with separate outline and fill colors?

According to the OpenGL docs, and other sources, it looks like I should be able to utilize the glPolygonOffset () function to give polygons that are drawn with GL_LINE “precedence” in the depth buffer by offsetting their comparison value by the argument to the function. (so I would think 1.0 would be sufficient)

How to render concave filled polygons in OpenGL?

After reading this chapter, you’ll be able to do the following: Render concave filled polygons by first tessellating them into convex polygons, which can be rendered using standard OpenGL routines.

What makes a polygon simple in OpenGL programming?

A polygon is simple if the edges intersect only at vertices, there are no duplicate vertices, and exactly two edges meet at any vertex.