121
Graphics / Re: Vector of structs which contains sprites
« on: February 08, 2020, 11:04:35 pm »
You're experiencing the white square problem. In this case it happens because you attempt to store the textures in a vector. Pushing an object into a vector will cause the vector to resize (if a specific size has not been reserved) moving everything the vector holds around in memory, which is why all but your last sprite appears white. Generally some sort of resource management is used to hold all your textures/shaders/audio buffers so that they can then be shared with any game entities that use them. The SFML Game Development book has a good example of how to do this.