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

Author Topic: sf::VertexBuffer  (Read 1514 times)

0 Members and 1 Guest are viewing this topic.

Garwin

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
sf::VertexBuffer
« on: May 10, 2023, 05:02:55 pm »
I have found that there is the possibility to use VertexBuffer which is stored in the memory of a graphical card.

I have an idea that it can be used eg. for borders in 4x game which is pretty static and updated once per huge time.

Is it in that case not better to have split game entities into static ones and moveable ones and store static ones in sf::VertexBuffer, especially the ones with a larger number of vertices?

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: sf::VertexBuffer
« Reply #1 on: May 10, 2023, 05:21:39 pm »
That sounds like just the exact reason it exists :)

It's worth noting that you may not need VertexBuffer at all if you aren't using lots of vertices or aren't having any speed issues.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Garwin

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: sf::VertexBuffer
« Reply #2 on: May 14, 2023, 10:08:18 pm »
Thanks. I am just trying to understand all corners of SFML and learn it to use it properly.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: sf::VertexBuffer
« Reply #3 on: May 15, 2023, 08:33:35 pm »
You're welcome! :)

It makes sense to want to know everything about it. That said, it's not required to know everything and you may have more enjoyment from getting the main things right and learning "extra" stuff later on ;)

Basically, what I'm saying, I think, is that if you understand vertex array (or using your own vertex data) then you'll have pretty much all scenarios covered. You may never need the vertex buffer (it's a recent addition and I still haven't had the chance to use it!) but it's there if you do need it.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*