SFML community forums
Help => Graphics => Topic started by: HeinzK 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?
-
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 (https://www.sfml-dev.org/documentation/3.0.0/classsf_1_1Texture.html#a9d6d90f015446eecb9a1e4cef8dc17b1).
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.