Two other major issues with your code:
sf::Packet& operator << (sf::Packet& packet, sf::Texture texture)
sf::Packet& operator >> (sf::Packet& packet, sf::Texture texture)
<< is very inefficient,
>> won't work at all. Use references as described in the tutorial (please read that carefully!).
tmpUint = new sf::Uint8[x * y * 4];
That's a nice memory leak. There's
no reason to use new, work with a
std::vector<sf::Uint8> instead.
And three minor issues in this line:
for (int i = 0; i < texture.getSize().x * texture.getSize().y * 4; i++)
- Use std::size_t (or at least unsigned int), not int -- you'll only get annoying conversion warnings otherwise
- ++i instead of i++ (convention, can be faster with iterators)
- precompute the size
I would also be careful with non-fixed size types.
(unsigned) int has no guaranteed size, that's why there are the
sf::{Int|Uint}{8|16|32|64} typedefs.
And you might consider working with
sf::Image rather than
sf::Texture. You only need textures for rendering, and you can still load them from images when you need that.