How to get wireframe display of a mesh using GLSL?


How to display the wireframe for a given mesh using GLSL?



Using line fill polygon mode will work great for triangulated meshes.

However, if you’re making a mesh out of quads, you’ll need a different approach, as GL_LINES will also draw the diagonal of the quad. One way around this is to create an element list with a primitive restart index (v0 v1 v2 v3 RS…) and draw with GL_LINE_LOOP.

You may need to use geometry shaders to have better control and draw any kind of convex polygon, some tutorial(shader examples are at the bottom):

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