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

Author Topic: VSync only working when called every iteration of game loop  (Read 1124 times)

0 Members and 1 Guest are viewing this topic.

Vitis

  • Newbie
  • *
  • Posts: 10
    • View Profile
Greetings SFML community!

I was having a seemingly intractable screen tearing problem with a simple test program that consisted of a movable sprite and a scrolling background.  I tried setting the frame rate with VSync disabled.  I tried enabling VSync with a single function call as recommended by SFML documentation.  I tired changing my frame rate several times.  I made sure my driver setting was set to "application control".  Nothing I tried solved the problem.  Then I decided to try enabling VSync by putting the function call inside my game loop so it was called every iteration, and that was the only thing that worked.  I am using window 7 and have an Intel HD 4600 Graphics Card. 

I feel I shouldn't have to keep enabling VSync inside my game loop.  Is anyone else having this problem?  Is it a driver issue or SFML issue?

-Vitis


EDIT:

In the process of writing a minimal example that reproduces the problem, I discovered the source of the Vsync / screen tearing issue.  My original test program has a function that allows the user to change the video mode.  The function closes the window and creates a new one with a different video mode, but the function doesn't enable vsync after the new window is created.  I believe that SFML sets vsync to disabled by default anytime a new window is created, so enabling vsync once when the program is initialized and enabling it again after each time the video mode is changed solves the screen tearing problem without having to call setVerticalSyncEnabled(true); in the game loop.

-Vitis
« Last Edit: June 27, 2014, 01:38:21 am by Vitis »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: VSync only working when called every iteration of game loop
« Reply #1 on: June 26, 2014, 10:05:11 am »
Please provide a complete and minimal example that reproduces the problem, to make sure you did everything right.

And how do you check if it working or not?
Laurent Gomila - SFML developer