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

Author Topic: Questions About Textures in SFML  (Read 3081 times)

0 Members and 1 Guest are viewing this topic.

diegonolan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Questions About Textures in SFML
« on: February 20, 2012, 01:32:40 am »
I have some questions regarding texture size and performance.

    Should textures width and heights always be powers of 2?  ie 128, 256, 512 etc I know it is important in other libraries but does sfml account for it?

    How do large images (100kb) affect performance?

    Whet is the best file format to use for the images? png, jpg... etc


Thanks

Weeve

  • Jr. Member
  • **
  • Posts: 87
  • C++ Programmer (Intermediate), 3D Artist (Skilled)
    • View Profile
    • Email
Questions About Textures in SFML
« Reply #1 on: February 20, 2012, 01:43:36 am »
use png if you want crisper images, because jpeg compresses them, and if you can, try to keep the dimensions in powers of 8, as processors prefer it, and 100 kb shoulden't be too large as to harm performance (if only you could feel the cringe I got when testing out the 3D game engine I built when rendering 3,000,000 polys....), computers now can take a ton of stress :), and depending on how sfml orders the storage, images might be rounded up to the next largest size i.e 64, 512, 1024, have luck :D
Long live rapid project development! -- Kestrel3D Game-Engine nearing completion

diegonolan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Questions About Textures in SFML
« Reply #2 on: February 20, 2012, 01:51:38 am »
Thanks, appreciate your feedback.

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Questions About Textures in SFML
« Reply #3 on: February 20, 2012, 12:58:46 pm »
The main reason for power of two textures is to more efficiently fill video memory. A non power of two texture will be padded and use the same amount of memory as the next up power of two size texture. An example: A 300x300 texture will use the same amount of memory as a 512x512 one.

I believe on ATi cards (at least in the past) it's also important to have square textures - a 512x256 texture would actually be padded to 512x512. I'm really not certain on this though and someone more knowledgable could clarify, but square textures are nice anyway. :wink:

100kb is a very small texture. I'm not sure if you're referring to the size of the compressed image on the hard drive or not. Keep in mind that textures are not stored compressed in V-RAM and that memory usage is (usually) much more important than disk space.

 

anything