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

Author Topic: Darken Edges of sf::VertexArray Polygon  (Read 1533 times)

0 Members and 1 Guest are viewing this topic.

hypnotix

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Darken Edges of sf::VertexArray Polygon
« on: July 04, 2015, 03:43:17 pm »
So, given a number of polygons that have been divided into triangles and saved in an sf::VertexArray(sf::PrimitiveType::Triangles), where no polygon shares points with another, how can I make something of an outline on every side of every triangle if each two points of the line are (a) not part of any other triangle in the array at the same time (so the side isn't shared with another triangle) and (b) at least one of the two is no inside any other triangle in the array.
Basically, here's a picture of what I have at the moment:
http://i.imgur.com/LWSEa9U.png
And here is what the outline I am talking about is supposed to look like:
http://i.imgur.com/4UJ5f5l.png
As far as I know, this should be done with shaders; unfortunately, that's all I am certain of regarding this problem. How could I go about achieving this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Darken Edges of sf::VertexArray Polygon
« Reply #1 on: July 04, 2015, 05:33:25 pm »
Doing this geometrically sounds a little complicated. Why don't you simply render your shape to a render-texture, and apply some effect to it (with a shader or whatever)?
Laurent Gomila - SFML developer

hypnotix

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Re: Darken Edges of sf::VertexArray Polygon
« Reply #2 on: July 04, 2015, 05:34:31 pm »
That's the thing, I have no idea how I'd do that. Shaders are not something I'm familiar with.

hypnotix

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Re: Darken Edges of sf::VertexArray Polygon
« Reply #3 on: July 04, 2015, 06:05:35 pm »
Where can I read up on shaders and possibly see how this would be done?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Darken Edges of sf::VertexArray Polygon
« Reply #4 on: July 04, 2015, 06:37:51 pm »
Google "GLSL tutorials".
Then Google "GLSL 2D edge".
Laurent Gomila - SFML developer

 

anything