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

Author Topic: Double Precision  (Read 8984 times)

0 Members and 1 Guest are viewing this topic.

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Double Precision
« on: February 04, 2011, 06:16:10 pm »
Hi Laurent,

Would it be possible to convert any reference to time like Clock::GetElapseTime and sf::Sleep from float to double?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Double Precision
« Reply #1 on: February 04, 2011, 06:35:09 pm »
Double is better but still not enough. Only integers can guarantee 100% accurate values. So if I change this, I'd rather choose uint32 (milliseconds).

But this is still not decided.
Laurent Gomila - SFML developer

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Double Precision
« Reply #2 on: February 04, 2011, 06:37:07 pm »
even better, go for it! :)

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Double Precision
« Reply #3 on: February 04, 2011, 06:45:20 pm »
While you’re at it, Window::SetFramerateLimit should take a real number or micro sec precision, add GetFramerateLimit() would also be useful.

let us know if you made the changes.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Double Precision
« Reply #4 on: February 04, 2011, 07:07:45 pm »
Quote from: "golgoth"
While you’re at it, Window::SetFramerateLimit should take a real number or micro sec precision, [...]

What for?
Want to play movies in your SFML application? Check out sfeMovie!

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Double Precision
« Reply #5 on: February 04, 2011, 09:37:15 pm »
NTSC for instance requires 29.97 frame per seconds.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Double Precision
« Reply #6 on: February 04, 2011, 09:51:00 pm »
That's peeky man :P

Really? will the 0.03 seconds make an hell out of your game? ;D

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Double Precision
« Reply #7 on: February 04, 2011, 10:20:59 pm »
Quote from: "golgoth"
NTSC for instance requires 29.97 frame per seconds.

Nothing prevents you from displaying 29.97 frames per second. The framerate limit is only a "limit". Besides, if your movie playback speed relies on this limit, you won't be able to to keep the display speed when the computer is too slow.
Want to play movies in your SFML application? Check out sfeMovie!

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Double Precision
« Reply #8 on: February 04, 2011, 10:21:39 pm »
Your assuming I’m making a real-time application and you are partially right but, regarding video playback, with this kind of latency, a movie will be 1.8 sec late after playing for a minute. Its seams picky but it’s a huge gap.  :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Double Precision
« Reply #9 on: February 04, 2011, 10:26:52 pm »
I wouldn't rely on SetFramerateLimit for video playback timing. It's far from accurate.
Laurent Gomila - SFML developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Double Precision
« Reply #10 on: February 04, 2011, 10:32:18 pm »
My english is still very bad :lol: .
Want to play movies in your SFML application? Check out sfeMovie!

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Double Precision
« Reply #11 on: February 04, 2011, 10:55:59 pm »
Nothing prevents you from displaying 29.97 frames per second.

This is mind boggling, AFAIK, when playing video, there is no point exceeding the display calls higher than the monitor refresh rate. I’m also guessing when precision is a must, v-synch should be disable. Otherwise, Swapping buffers will have to wait until the next monitor refresh, even if a frame is ready to display. Thus, adding delay.

I wouldn't rely on SetFramerateLimit for video playback timing. It's far from accurate.

Is GetFrameTime reliable?

Milliseconds precision would be nice indeed!  8)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Double Precision
« Reply #12 on: February 04, 2011, 11:10:43 pm »
Quote
Is GetFrameTime reliable?

Yes, almost 100% (there's a bug with the high-performance timer on Windows with certain configurations).

What's not reliable is a call to sf::Sleep (in case that's what you want to use).
Laurent Gomila - SFML developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Double Precision
« Reply #13 on: February 04, 2011, 11:37:47 pm »
Quote from: "golgoth"
This is mind boggling, AFAIK, when playing video, there is no point exceeding the display calls higher than the monitor refresh rate. I’m also guessing when precision is a must, v-synch should be disable. Otherwise, Swapping buffers will have to wait until the next monitor refresh, even if a frame is ready to display. Thus, adding delay.

You don't need to get a higher frame rate if the only thing you're displaying is your movie. I don't know whether this is your case.

And with vertical synchronization one indeed add delay, but one also get perfect pictures. This can be important if you have a lot of (fast) movements in your movie.
Want to play movies in your SFML application? Check out sfeMovie!

golgoth

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Double Precision
« Reply #14 on: February 04, 2011, 11:58:47 pm »
Quote
(there's a bug with the high-performance timer on Windows with certain configurations)

Sorry what bug?

Quote
What's not reliable is a call to sf::Sleep (in case that's what you want to use).

I definitely need Sleep to be as precise as it could get.

I’m having a hard time synchronizing video playback, if there is something unreliable regarding timing, it would make my like much more healthy, because so far, I feel like I’m taking crazy pills.

I made a little test whish almost gave me an heart attack! l_time doesn’t return 0 but ~2 sec… whish doesn’t make any sense.

Code: [Select]
sf::Clock l_clock;
l_clock.Reset();
Float l_time = l_clock.GetElapsedTime();

 :shock: