Hi Everyone,
I picked up SFML in the weekend hoping to replace my existing graphics library with SFML.
CImg is good for direct graphics manipulations, better actually, but it's not fast and it does graphics only.
I'm hoping to use the abstractions for networking and audio too, and switch from -std=gnu11 to c++11,
so I can finally use STL threads. That's the backstory.
Anyways, while porting my drawing procedures, I do a switch from Image, over Texture and Sprite, then RenderTexture.
An awful lot of conversions - I realise that, I thought Image would be something I could write to, but after discovering RenderTexture, I'll probably remove the first conversions.
To dump the image, I convert back from over Texture to Image. The image is crisp and exactly like the original, except that the Y-axis is inverted entirely. This even goes for the bits of text I've drawn (and on the RenderTexture mind you, so unless a transform matrix was copied from the prior types. I think the culprit is to be found in the last conversions).
At first, after making an Image with the right background colour:
sf::Texture texture;
texture.loadFromImage(image);
sf::Sprite sprite(texture);
sf::RenderTexture renderTexture;
renderTexture.create(image.getSize().x, image.getSize().y);
renderTexture.draw(sprite);
I do my drawing using a classic origo-in-top-left-corner approach, then save the image to a file like so:
image = renderTexture.getTexture().copyToImage();
image.saveToFile(filename.c_str());
Thank you for your help, and thanks SFML devs for making this broad library for me to use.