Search code examples
c++graphicsopengl-esglsltessellation

How to see the generated edges after tessellation?


I am trying to see how my mesh is being transformed by the tessellation shader. I have seen multiple images of this online so i know it is possible.

Reading the khronos wiki it seems that to generate the same behaviour as GL_LINES I should set the patch vertices to 2 like this:

glPatchParameteri(GL_PATCH_VERTICES, 2)

However this results in the exact same output as

glPatchParameteri(GL_PATCH_VERTICES, 3)

In other words, I am seeing filled triangles instead of lines. I am drawing using GL_PATCHES and I am not getting compilation nor runtime errors.

How can I see the generated edges?


Solution

  • If you cannot use the polygon mode, you can employ the geometry shader. The geometry shader is a stage that is executed after tessellation. So, you can have a geometry shader that takes a triangle as input and produces a line strip of three lines as output. This will show the wireframe. It will also draw inner edges twice, though.