How to see the generated edges after tessellation?










1















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?










share|improve this question




























    1















    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?










    share|improve this question


























      1












      1








      1








      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?










      share|improve this question
















      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?







      c++ graphics opengl-es glsl tessellation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 21:10









      genpfault

      42.5k954100




      42.5k954100










      asked Nov 15 '18 at 16:08









      MakoganMakogan

      1,8581830




      1,8581830






















          3 Answers
          3






          active

          oldest

          votes


















          4














          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.






          share|improve this answer






























            1














            Just use glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); in your initialization code. Also you can call this based on some key so that you can toggle between wireframe and polygon mode.






            share|improve this answer























            • This is probably the right answer for the actual question, but I am on OpenGL ES 3.2 so I cannot change the polygon mode, any suggestions?

              – Makogan
              Nov 15 '18 at 16:29











            • That would be little but tricky but doable. Make your drawing two pass . In first pass bind transform feedback.After tessellation stage output your geometry to this transform feedback buffer. Second pass draw the geometry in transform feedback as Line or Line loop or use Geometry shader which comes after tessellation shader take input as triangle/patch and output line as primitve.

              – Paritosh Kulkarni
              Nov 15 '18 at 17:07



















            1














            I would like to point out that this question represents a stark misunderstanding of how Tessellation works.



            The number of vertices in a patch is irrelevant to "how my mesh is being transformed by the tessellation shader".



            Tessellation is based on an abstract patch. That is, if your TES uses triangles as its abstract patch type, then it will generate triangles. This is just as true whether your vertices-per-patch count is 20 or 2.



            The job of the code in the TES is to figure out how to apply the tessellation of the abstract patch to the vertex data of the patch in order to produce the actual tessellated output vertex data.



            So if you're tessellating a triangle, your TES gets a 3-element barycentric coordinate (gl_TessCoord) that determines the location in the abstract triangle to generate the vertex data for. The tessellation primitive generator's job is to decide which vertices to generate and how to assemble them into primitives (triangle edge connectivity).



            So basically, the number of patch vertices is irrelevant to the edge connectivity graph. The only thing that matters for that is the abstract patch type and the tessellation levels being applied to it.






            share|improve this answer






















              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323488%2fhow-to-see-the-generated-edges-after-tessellation%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              4














              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.






              share|improve this answer



























                4














                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.






                share|improve this answer

























                  4












                  4








                  4







                  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.






                  share|improve this answer













                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 15 '18 at 17:06









                  Nico SchertlerNico Schertler

                  25.6k42450




                  25.6k42450























                      1














                      Just use glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); in your initialization code. Also you can call this based on some key so that you can toggle between wireframe and polygon mode.






                      share|improve this answer























                      • This is probably the right answer for the actual question, but I am on OpenGL ES 3.2 so I cannot change the polygon mode, any suggestions?

                        – Makogan
                        Nov 15 '18 at 16:29











                      • That would be little but tricky but doable. Make your drawing two pass . In first pass bind transform feedback.After tessellation stage output your geometry to this transform feedback buffer. Second pass draw the geometry in transform feedback as Line or Line loop or use Geometry shader which comes after tessellation shader take input as triangle/patch and output line as primitve.

                        – Paritosh Kulkarni
                        Nov 15 '18 at 17:07
















                      1














                      Just use glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); in your initialization code. Also you can call this based on some key so that you can toggle between wireframe and polygon mode.






                      share|improve this answer























                      • This is probably the right answer for the actual question, but I am on OpenGL ES 3.2 so I cannot change the polygon mode, any suggestions?

                        – Makogan
                        Nov 15 '18 at 16:29











                      • That would be little but tricky but doable. Make your drawing two pass . In first pass bind transform feedback.After tessellation stage output your geometry to this transform feedback buffer. Second pass draw the geometry in transform feedback as Line or Line loop or use Geometry shader which comes after tessellation shader take input as triangle/patch and output line as primitve.

                        – Paritosh Kulkarni
                        Nov 15 '18 at 17:07














                      1












                      1








                      1







                      Just use glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); in your initialization code. Also you can call this based on some key so that you can toggle between wireframe and polygon mode.






                      share|improve this answer













                      Just use glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); in your initialization code. Also you can call this based on some key so that you can toggle between wireframe and polygon mode.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 15 '18 at 16:14









                      Paritosh KulkarniParitosh Kulkarni

                      603413




                      603413












                      • This is probably the right answer for the actual question, but I am on OpenGL ES 3.2 so I cannot change the polygon mode, any suggestions?

                        – Makogan
                        Nov 15 '18 at 16:29











                      • That would be little but tricky but doable. Make your drawing two pass . In first pass bind transform feedback.After tessellation stage output your geometry to this transform feedback buffer. Second pass draw the geometry in transform feedback as Line or Line loop or use Geometry shader which comes after tessellation shader take input as triangle/patch and output line as primitve.

                        – Paritosh Kulkarni
                        Nov 15 '18 at 17:07


















                      • This is probably the right answer for the actual question, but I am on OpenGL ES 3.2 so I cannot change the polygon mode, any suggestions?

                        – Makogan
                        Nov 15 '18 at 16:29











                      • That would be little but tricky but doable. Make your drawing two pass . In first pass bind transform feedback.After tessellation stage output your geometry to this transform feedback buffer. Second pass draw the geometry in transform feedback as Line or Line loop or use Geometry shader which comes after tessellation shader take input as triangle/patch and output line as primitve.

                        – Paritosh Kulkarni
                        Nov 15 '18 at 17:07

















                      This is probably the right answer for the actual question, but I am on OpenGL ES 3.2 so I cannot change the polygon mode, any suggestions?

                      – Makogan
                      Nov 15 '18 at 16:29





                      This is probably the right answer for the actual question, but I am on OpenGL ES 3.2 so I cannot change the polygon mode, any suggestions?

                      – Makogan
                      Nov 15 '18 at 16:29













                      That would be little but tricky but doable. Make your drawing two pass . In first pass bind transform feedback.After tessellation stage output your geometry to this transform feedback buffer. Second pass draw the geometry in transform feedback as Line or Line loop or use Geometry shader which comes after tessellation shader take input as triangle/patch and output line as primitve.

                      – Paritosh Kulkarni
                      Nov 15 '18 at 17:07






                      That would be little but tricky but doable. Make your drawing two pass . In first pass bind transform feedback.After tessellation stage output your geometry to this transform feedback buffer. Second pass draw the geometry in transform feedback as Line or Line loop or use Geometry shader which comes after tessellation shader take input as triangle/patch and output line as primitve.

                      – Paritosh Kulkarni
                      Nov 15 '18 at 17:07












                      1














                      I would like to point out that this question represents a stark misunderstanding of how Tessellation works.



                      The number of vertices in a patch is irrelevant to "how my mesh is being transformed by the tessellation shader".



                      Tessellation is based on an abstract patch. That is, if your TES uses triangles as its abstract patch type, then it will generate triangles. This is just as true whether your vertices-per-patch count is 20 or 2.



                      The job of the code in the TES is to figure out how to apply the tessellation of the abstract patch to the vertex data of the patch in order to produce the actual tessellated output vertex data.



                      So if you're tessellating a triangle, your TES gets a 3-element barycentric coordinate (gl_TessCoord) that determines the location in the abstract triangle to generate the vertex data for. The tessellation primitive generator's job is to decide which vertices to generate and how to assemble them into primitives (triangle edge connectivity).



                      So basically, the number of patch vertices is irrelevant to the edge connectivity graph. The only thing that matters for that is the abstract patch type and the tessellation levels being applied to it.






                      share|improve this answer



























                        1














                        I would like to point out that this question represents a stark misunderstanding of how Tessellation works.



                        The number of vertices in a patch is irrelevant to "how my mesh is being transformed by the tessellation shader".



                        Tessellation is based on an abstract patch. That is, if your TES uses triangles as its abstract patch type, then it will generate triangles. This is just as true whether your vertices-per-patch count is 20 or 2.



                        The job of the code in the TES is to figure out how to apply the tessellation of the abstract patch to the vertex data of the patch in order to produce the actual tessellated output vertex data.



                        So if you're tessellating a triangle, your TES gets a 3-element barycentric coordinate (gl_TessCoord) that determines the location in the abstract triangle to generate the vertex data for. The tessellation primitive generator's job is to decide which vertices to generate and how to assemble them into primitives (triangle edge connectivity).



                        So basically, the number of patch vertices is irrelevant to the edge connectivity graph. The only thing that matters for that is the abstract patch type and the tessellation levels being applied to it.






                        share|improve this answer

























                          1












                          1








                          1







                          I would like to point out that this question represents a stark misunderstanding of how Tessellation works.



                          The number of vertices in a patch is irrelevant to "how my mesh is being transformed by the tessellation shader".



                          Tessellation is based on an abstract patch. That is, if your TES uses triangles as its abstract patch type, then it will generate triangles. This is just as true whether your vertices-per-patch count is 20 or 2.



                          The job of the code in the TES is to figure out how to apply the tessellation of the abstract patch to the vertex data of the patch in order to produce the actual tessellated output vertex data.



                          So if you're tessellating a triangle, your TES gets a 3-element barycentric coordinate (gl_TessCoord) that determines the location in the abstract triangle to generate the vertex data for. The tessellation primitive generator's job is to decide which vertices to generate and how to assemble them into primitives (triangle edge connectivity).



                          So basically, the number of patch vertices is irrelevant to the edge connectivity graph. The only thing that matters for that is the abstract patch type and the tessellation levels being applied to it.






                          share|improve this answer













                          I would like to point out that this question represents a stark misunderstanding of how Tessellation works.



                          The number of vertices in a patch is irrelevant to "how my mesh is being transformed by the tessellation shader".



                          Tessellation is based on an abstract patch. That is, if your TES uses triangles as its abstract patch type, then it will generate triangles. This is just as true whether your vertices-per-patch count is 20 or 2.



                          The job of the code in the TES is to figure out how to apply the tessellation of the abstract patch to the vertex data of the patch in order to produce the actual tessellated output vertex data.



                          So if you're tessellating a triangle, your TES gets a 3-element barycentric coordinate (gl_TessCoord) that determines the location in the abstract triangle to generate the vertex data for. The tessellation primitive generator's job is to decide which vertices to generate and how to assemble them into primitives (triangle edge connectivity).



                          So basically, the number of patch vertices is irrelevant to the edge connectivity graph. The only thing that matters for that is the abstract patch type and the tessellation levels being applied to it.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 15 '18 at 20:59









                          Nicol BolasNicol Bolas

                          290k34481655




                          290k34481655



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323488%2fhow-to-see-the-generated-edges-after-tessellation%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              這個網誌中的熱門文章

                              What does pagestruct do in Eviews?

                              Dutch intervention in Lombok and Karangasem

                              Channel Islands