# Turning On/Off Vsync no longer working when rendering to an offscreen buffer

I have this reaallly strange issue that as soon as I render to an offscreen framebuffer I am no longer able to toggle VSync while my application is running. I am using OpenTK as the opengl wrapper, but I have a strong feeling it's not related at all to OpenTK.

The odd thing is I can still turn VSync on/off during startup of the application, but not anymore while the game is running. If I temporarily redirect rendering to the default framebuffer i can also again toggle Vsync.

I can use an ugly hack to just redirect rendering to the default framebuffer, a frame later set toggle vsync mode, then redirect rendering to the offscreen framebuffer again, however I would much prefer a proper fix.

Here's some pesudo code what my code does:

Initialize 2 Framebuffers. Bind first offscreen framebuffer.
while(!exit) {
Render opaque stuff
Switch to second framebuffer for transparent objects
Render transparent stuff
Switch to first buffer
Render transparent texture to primary buffer
Switch to default framebuffer (default FB in write mode, first FB in readmode)
Blit from first to default framebuffer
Bind first offscreen FB
}


I had to use offscreen frame buffers in order to re-use the depth buffer in the transparent render pass for implementing WOIT (Weighted Blended Order Independent Transparency)

• Providing the actual code might be a better idea, as your pseudo code may be missing what is causing the problem. Try and make as small a sample as possible that reproduces the issue. – William Mariager Mar 31 '16 at 11:14
• "no longer" / "not anymore while the game is running" - have you reverted to an earlier version of your code where it DID work? If not that, then it must be a local OS/driver level configuration issue, so trying it on a different system might help. Otherwise you are bashing your head against a brick wall when it's not even a problem with the code. – Engineer Apr 2 '16 at 11:40
• There is no earlier version, as soon as i implemented offscreen buffering, the problem started to appear. I then added a switch to toggle between rendering to offscreen FB or to default FB while my application is running - that lets me again set Vsync when rendering to default FB (i can literally switch between them during rendering, then switch vsync on/off and the latter only works as long as i'm not rendering offscreen) – Tyron Apr 2 '16 at 11:55