Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 1.6 Screen Capture takes a while  (Read 2732 times)

0 Members and 1 Guest are viewing this topic.

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
SFML 1.6 Screen Capture takes a while
« on: December 30, 2010, 09:34:18 am »
Hi
Is there a way to speed up a screen capture in SFML 1.6? At the moment, there is a reasonably long pause (~1-2 seconds) when you tell it to do a screenshot.
Thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 1.6 Screen Capture takes a while
« Reply #1 on: December 30, 2010, 09:45:25 am »
Is it the capture function that takes so much time, or saving the image to a file?

Can you show the relevant code?
Laurent Gomila - SFML developer

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
SFML 1.6 Screen Capture takes a while
« Reply #2 on: December 30, 2010, 09:49:57 am »
Sorry, it's the saving to file.
Code: [Select]
char time_and_date[32];
time_t time_ref = time(0);
tm * screenshot_time;

screenshot_time = localtime(&time_ref);
strftime(time_and_date, 32, "%Y-%m-%d-%H%M%S.jpg", screenshot_time);
std::cout << time_and_date << std::endl;
sf::Image Screen = App.Capture();
Screen.SaveToFile(time_and_date);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 1.6 Screen Capture takes a while
« Reply #3 on: December 30, 2010, 10:24:58 am »
Are you running in debug or release mode? Have you tried other file formats?
Laurent Gomila - SFML developer

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
SFML 1.6 Screen Capture takes a while
« Reply #4 on: January 02, 2011, 09:32:28 am »
Not sure how to save as different formats (changing the extension? Does this change the internal format?), and I'm using the debug mode (I think) in Code::Blocks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 1.6 Screen Capture takes a while
« Reply #5 on: January 02, 2011, 12:20:17 pm »
Quote
Not sure how to save as different formats (changing the extension? Does this change the internal format?)

Yes, format is based on extension (would be insane to get a JPEG image inside "toto.png" ;) ).

Quote
and I'm using the debug mode

Ok, so performances don't mean anything (debug mode is for debugging, nothing else). Switch to release when you want to benchmark things.
Laurent Gomila - SFML developer