Come tratto direttamente dal tutorial grafico-sprite sul sito Web SFML
"The loadFromFile function sometimes fails with no obvious reason. First, check the error message printed by SFML in the
standard output (check the console). If the message is unable to open file, make sure that the working directory (which is the
directory any file path will be interpreted relatively to) is what you think it is: when you run the application from the explorer, the
working directory is the executable folder, but when you launch your program from your IDE (Visual Studio, Code::Blocks, ...) the
working directory is sometimes set to the project directory instead. This can generally be changed easily in the project settings."
Pertanto, assicurati che la tua immagine sia prima denominata correttamente e secondo, assicurati che sia nella cartella corretta, ad esempio nella directory di lavoro.
Inoltre, se la trama non riesce a caricare invece di restituire uno sprite vuoto, è possibile segnalare un errore alla console e quindi lanciare un'eccezione. In questo modo ti verrà detto che lo sprite non si carica correttamente e il programma dovrà gestire l'eccezione altrimenti verrà terminata. In questo modo nessun sprite nel gioco dovrebbe avere una trama bianca a meno che non sia intenzionale
Qualcosa come questo:
sf::Texture texture;
if (!texture.loadFromFile("image.png"))
{
throw std::runtime_error("Could not load image.png");
}