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

Author Topic: Problem with frame times  (Read 2963 times)

0 Members and 1 Guest are viewing this topic.

SvenB

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • http://www.psych.uni-halle.de/sven/
Problem with frame times
« on: July 10, 2008, 01:48:56 pm »
Hi, I'm just checking the display timing (sfml 1.3, WinXP SP3) and do
not understand all the results...

Code: [Select]
Screen0.UseVerticalSync(true);
        Clock.Reset() ;
        do {
            Screen0.Draw( Text ) ;
            Text.Move( 1,1 ) ;
            times[ i++ % 100 ] = Screen0.GetFrameTime() ;
            Screen0.Display() ;
        } while( Clock.GetElapsedTime() < 2.0f ) ;


Since the graphics refresh rate is 60 Hz, I expected a 16.6 ms frame time.
Actually, the frame times are 16.5 to 16.8 ms. That's fine.

Now, I'm doing the same without any output to the screen:

Code: [Select]
Screen0.UseVerticalSync(true);
        Clock.Reset() ;
        do {
             times[ i++ % 100 ] = Screen0.GetFrameTime() ;
            Screen0.Display() ;
        } while( Clock.GetElapsedTime() < 2.0f ) ;


Again I expect 16.6 ms frame time but I get 14.5 to 14.7 ms.
How is this possible with 60 Hz refresh rate and UseVerticalSync( true )?

Now I switched off vertical sync:

Code: [Select]
Screen0.UseVerticalSync(false);
        Clock.Reset() ;
        do {
             times[ i++ % 100 ] = Screen0.GetFrameTime() ;
            Screen0.Display() ;
        } while( Clock.GetElapsedTime() < 2.0f ) ;


Same timing results... as if UseVerticalSync(false) does not work.

Now I tried a little bit more graphics and vertical sync on:

Code: [Select]
Screen0.UseVerticalSync(true);
        Clock.Reset() ;
        do {
            Screen0.Draw( Line ) ;
            Screen0.Draw( Circle ) ;
            Screen0.Draw( Rect ) ;
            Screen0.Draw( Text ) ;
            Screen0.Draw( Polygon ) ;
            Text.Move( 1,1 ) ;
            Circle.Move(1,-1) ;
            Rect.Rotate(1) ;
            times[ i++ % 100 ] = Screen0.GetFrameTime() ;
            Screen0.Display() ;
        } while( Clock.GetElapsedTime() < 2.0f ) ;


This results in frame times of approx. 18-19 ms. How that? With
UseVerticalSync(true) I expect frame times as integer multiples of
1000 / FrameRate, for a 60 Hz graphics card 16.6 or 33.2 and so on.

Any idea?

Thanks in advance - Sven