Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Termination of a linestrip sequence?  (Read 1911 times)

0 Members and 1 Guest are viewing this topic.

jaja

  • Guest
Termination of a linestrip sequence?
« on: January 05, 2018, 06:26:13 pm »
I am drawing linestrips to make quads (I know there is a primitive type for that but I want edges without a fill colour). I am getting lines being drawn across different quads to the wrong vertices as shown in the attached picture. I just want to be sure it is not the case where if I call renderwindow.draw on a vertex array of 4 vertices, that the last vertex is being connected to the next array.

And yes, that is supposed to look like a cube  :)


Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: Termination of a linestrip sequence?
« Reply #1 on: January 07, 2018, 11:39:41 am »
i don't know if i got your question, but the linestrip shoudn't connect the last vertex to the first one. first, make sure you are drawing everything in the correct order you need. if you put a vertex in top left corner and the next one in bottom right, you'll have a line crossing this space, no matter what's inside. maybe the code could help undertanding what you want to do and what's the problem.

anyway, if you want quads without a fill color, you can use sf::Quads and set the FillCollor to sf::Color::Transparent.
Visit my game site (and hopefully help funding it? )
Website | IndieDB

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
Re: Termination of a linestrip sequence?
« Reply #2 on: January 16, 2018, 02:27:53 am »
That's not quite right Stauricus - vertex arrays don't have setFillColor as the colour is defined in the vertices, so (as far as I know) there's no straightforward way of creating a quad outline with sf::Quads

to OP - If you use separate vertexArrays they won't be connected whatsoever. If you want to draw all of them in one array you could use sf::Lines although that will require extra vertices (8 per quad instead of 4)

 

anything