SFML community forums

Help => Window => Topic started by: SvenB on September 12, 2008, 02:22:36 pm

Title: useless UseVerticalSync()?!?
Post by: SvenB on September 12, 2008, 02:22:36 pm
Hi all,

while testing frame rates I came upon the following problem: changing between UseVerticalSync(true) and UseVerticalSync(false) does not make any difference. On my desktop computer I have a frame rate of 250 Hz (graphics card set to 60 Hz) irrespective of VerticalSync true or false. On my Laptop I have a frame rate of 40 (!) Hz (graphics card set to 60 Hz).


Code: [Select]
 while( Screen0.IsOpened() ) {
        Screen0.UseVerticalSync(true);  // or false
        Clock.Reset() ;
        do {
            Screen0.Draw( Text ) ;
            Framerate = 1.0f / Screen0.GetFrameTime();
            std::sprintf( buf, "Refreshrate %5.2f Hz", Framerate ) ;
            Text2.SetText( buf ) ;
            Screen0.Draw( Text2 ) ;
            Screen0.Display() ;
        } while( Clock.GetElapsedTime() < 5.0f ) ;
      Screen0.Close() ;
    }


Obviously UseVerticalSync does not work. Does anybody have any idea why?
Title: useless UseVerticalSync()?!?
Post by: Laurent on September 12, 2008, 02:28:49 pm
v-sync is first controlled by your graphics driver. The option must be set to "let application choose", otherwise it will be forced to on or off whatever you do.