SFML community forums

Help => Graphics => Topic started by: happy11 on August 11, 2023, 05:40:32 am

Title: draw triangles primitives as wires?
Post by: happy11 on August 11, 2023, 05:40:32 am
I noticed that opening and drawing through RenderWindow with VertexArray and the primitive TRIANGLES produces a filled triangle.

How can I make it draw the triangle as wires/lines instead?

obviously I can draw using lines or linestrips but it is importent for me the keep the structure of the array so using these primitives defeats the purpose.

looking for something similar to 'glPolygonMode'
Title: Re: draw triangles primitives as wires?
Post by: fallahn on August 11, 2023, 10:27:23 am
There's nothing like that in the SFML api as far as I know, but you can probably expose the OpenGL function by including <SFML/OpenGL.hpp> then calling it around your vertex array

Code: [Select]
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
myArray.draw();
myOtherArray.draw();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);