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

Author Topic: Question for best performance  (Read 3575 times)

0 Members and 1 Guest are viewing this topic.

roccio

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Question for best performance
« on: December 14, 2015, 09:33:45 am »
Hello, I have a big texture (up tp 4096 or 8192) that is the background of my game. I would like to know what is better to render, one big rect with the same size of the texture, or a rect large as the game window and scrolling the textureRect, or split it in several tiles everyone mapped with the corrects coordinates inside the big texture.

Thank you for your advise!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Question for best performance
« Reply #1 on: December 14, 2015, 09:40:46 am »
It depends on which hardware you plan to make your app work. If you target low-end machines, then you'll have to split your images to 512x512 (that's the maximum reliable texture size) anyway.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Question for best performance
« Reply #2 on: December 14, 2015, 09:50:22 am »
You could also have a look at thor::BigSprite and thor::BigTexture. They can split images automatically for you.

However, it may be easier (and potentially more efficient) to use smaller textures in the first place, if you know you want maximum portability.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

roccio

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Re: Question for best performance
« Reply #3 on: December 14, 2015, 09:53:59 am »
Ok, I will go in the split way. Thank you very much!

Jabberwocky

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: Question for best performance
« Reply #4 on: December 15, 2015, 08:24:32 pm »
It depends on which hardware you plan to make your app work. If you target low-end machines, then you'll have to split your images to 512x512 (that's the maximum reliable texture size) anyway.

That's really low end hardware.
Like maybe a cheap tablet?  Or 15 year old computer?

But yeah, an 8192x8192 texture is going to chew up a gfx card's memory pretty fast.

8192x8192x4 = 256 MB vram in one texture.
Don't do that - split it up as others have recommended.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Question for best performance
« Reply #5 on: December 15, 2015, 08:47:32 pm »
Quote
That's really low end hardware.
Like maybe a cheap tablet?  Or 15 year old computer?
I'd say Intel integrated chips from only a few years back, like many laptops have. But yeah, maybe now 1024x1024 can be considered safe too.
« Last Edit: December 15, 2015, 08:50:40 pm by Laurent »
Laurent Gomila - SFML developer

Jabberwocky

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Re: Question for best performance
« Reply #6 on: December 16, 2015, 12:56:43 am »
I'm pretty sure you'd have to go back at least a decade to find an intel integrated card incapable of handling 1024x1024.

roccio

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
    • Email
Re: Question for best performance
« Reply #7 on: December 23, 2015, 12:25:12 pm »
Thanks all.
But the real question is:

is better to have few big sprites or many little ones?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Question for best performance
« Reply #8 on: December 23, 2015, 12:31:59 pm »
Quote
is better to have few big sprites or many little ones?
Obviously few big ones : that's less points to transform and less driver calls, for the same amount of pixels drawn.
Laurent Gomila - SFML developer