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)