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

Author Topic: Should i use sf::Texture or sf::VertexArray for this?  (Read 1814 times)

0 Members and 1 Guest are viewing this topic.

Evaghetti

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Should i use sf::Texture or sf::VertexArray for this?
« on: September 10, 2017, 01:36:51 am »
So, i was thinking about making a game like Fire Emblem(if you don't know how it is, there's a picture bellow) in the sense that it is a Tactical RPG with a tilemap to move your units around the battlefield, until here everything is fine, but then i remembered a question that i always had when i first dived into SFML



Why is using sf::VertexArray is so much faster than using some sf::Texture? Some time ago i made a game that also used a tilemap but instead i used sf::Texture with a texture manager(so i didn't load the same texture more than one time) that i made and it did run pretty well, should i have used sf::VertexArray instead? Or just for the example that they gave on the tutorial it would be beneficial to use sf::VertexArray since there's no interaction with the person using the PC unlike a game like Fire Emblem?

I already am thanking you for reading up to this point and sorry for any bad english, it is not my native language after all.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11029
    • View Profile
    • development blog
    • Email
Re: Should i use sf::Texture or sf::VertexArray for this?
« Reply #1 on: September 10, 2017, 09:24:24 am »
You'll have to use a texture with a vertex array as well, what you mean is using sprites instead of vertex arrays.

As long as you're not running into performance issues with sprites, then you're fine. There's no reason to change things just because.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Evaghetti

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Should i use sf::Texture or sf::VertexArray for this?
« Reply #2 on: September 10, 2017, 06:36:30 pm »
Oh, sorry for the mistake :P

And thank you for the insight, now i'll start coding the game and see how the perfomance turns out to be.

 

anything