|
[A5] How to draw triangle list outlines only |
BitCruncher
Member #11,279
August 2009
|
Hi all, Is there a way to call al_draw_vertex_buffer() with ALLEGRO_PRIM_TRIANGLE_LIST so that it will draw the vertex list as triangles but not fill them?
|
MikiZX
Member #17,092
June 2019
|
I am a noob so cannot really help directly - only some thoughts: You will likely need to create a separate index buffer (using your existing vertex buffer of vertices) for this and then draw this new index buffer using al_draw_indexed_buffer and ALLEGRO_PRIM_LINE_LIST. If you are using OpenGL, you might have another option (though I have not tested this). and then execute: // draw the wireframe // restore default polygon mode Possibly you will want to do this as well: Polygon mode used here: Though, as mentioned I am new to Allegro5 so likely someone who knows much more will post a better way. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
MikiZX, you're right on. Using an index buffer and a line list will work, and setting glPolygonMode should do the trick too. Don't doubt yourself. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
BitCruncher
Member #11,279
August 2009
|
I haven't had time to test this, but it seems right, so +1. Thanks.
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
Bump for update. Please share your results when you have time. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Elias
Member #358
May 2000
|
I have a debug option in my game to switch everything to wireframe - I do it inside of my pixel shader. When the wireframe uniform is set to true it will only draw the outline of each triangle instead of filling it. The advantage is that you do not change anything in your actual drawing code at all (except maybe adding barycentric coordinate attributes), and it's easy to adjust the look of the wireframe. Just google for "wireframe glsl shader" and you will find plenty, for example this one: https://github.com/rreusser/glsl-solid-wireframe -- |
|