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

Author Topic: 2.6.2 to 3.0 loadFromImage  (Read 289 times)

0 Members and 1 Guest are viewing this topic.

HeinzK

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
    • ZwiAner
    • Email
2.6.2 to 3.0 loadFromImage
« on: January 24, 2025, 10:09:15 am »
V2:
sf::Texture *pTextureX = new sf::Texture;
pTextureX->loadFromImage(*pTxu->pImage, *pIntRectTextureX);
V3:
sf::Texture *pTextureX = new sf::Texture;
pTextureX->loadFromImage(*pTxu->pImage, bRGB, *pIntRectTextureX);
.. bRGB (true or false) .. what's right for me?
The trees, that obstruct the view on the forest, can be allowed to fall! (Die Bäume, die die Sicht auf einen Wald versperren, dürfen gefällt werden!)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11110
    • View Profile
    • development blog
    • Email
Re: 2.6.2 to 3.0 loadFromImage
« Reply #1 on: January 24, 2025, 11:01:50 am »
Unless you use sRGB you want it to eb set to false, which is also the default value if you don't pass in an area, see the API documentation.

I highly recommend to either use stack variables or at least smart pointers (e.g. std::unique_ptr + std::make_unique) instead of doing manual memory management with new.
Official FAQ: https://www.sfml-dev.org/faq/
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything