SFML community forums
Help => Graphics => Topic started by: chadushkind on February 19, 2014, 02:43:37 pm
-
when i run the application, I get a white square. Why? And how to fix it? Thnx.
-
Have you searched before posting? This problem has appeared dozens of times in the past. It always has to do with textures that are invalidated.
There are several mistakes in your code: You don't check for errors when loading, you return a copy (instead of reference) in GetTexture(), and you needlessly allocate a dynamic texture, where you could directly load the texture inside the map. The destructor is also unnecessary, STL containers clean up properly on their own.
-
Have you searched before posting? This problem has appeared dozens of times in the past. It always has to do with textures that are invalidated.
There are several mistakes in your code: You don't check for errors when loading, you return a copy (instead of reference) in GetTexture(), and you needlessly allocate a dynamic texture, where you could directly load the texture inside the map. The destructor is also unnecessary, STL containers clean up properly on their own.
Thank you very much. I used the search before, I understood the problem, but I did not understand the decision. I did not consider the option of using references. Thank you again!