Hello there.
I am using SFML to visualise and record a simulation for my thesis.
I have written a code for recording the window to use for visual analysis. Leaning on this blogpost
https://en.sfml-dev.org/forums/index.php?topic=25254.0 I have the following:
if (recording) {
sf::Texture texture;
texture.create(window->getSize().x, window->getSize().y);
texture.update(*window);
std::string filename = "recordings/frame_" + counterToString(recordingCounter, 5) +".png";
texture.copyToImage().saveToFile(filename);
recordingCounter++;
if (recordingCounter % 100 == 0) {
std::cout << "Frames made: " << recordingCounter << std::endl;
}
}
where recording is a boolean that can be set to True via pressing the R key on the keyboard.
Unfortunately, it doesn't seem to be working, and I get an error message when trying to record:
Start recording...
Failed to save image "recordings/frame_00000.png"
Failed to save image "recordings/frame_00001.png"
Failed to save image "recordings/frame_00002.png"
Failed to save image "recordings/frame_00003.png"
Failed to save image "recordings/frame_00004.png"
Failed to save image "recordings/frame_00005.png"
Failed to save image "recordings/frame_00006.png"
Failed to save image "recordings/frame_00007.png"
Failed to save image "recordings/frame_00008.png"
Failed to save image "recordings/frame_00009.png"
Failed to save image "recordings/frame_00010.png"
Recording stopped.
Would somebody have an idea what the issue could be? In case it's necessary, I will attach the whole header file below. I've been sitting on this for a while now but my troubleshooting skills aren't necessary the best