I'm starting to learn the GPipe library, and was wondering how someone could accomplish vsync and FPS control with it. Initially, I was thinking a separate thread could block every 1 * 1000000 / FPS
microseconds and run swapContextBuffers
, but that would mean the separate thread would need to build its own ContextT
, and thus it's own window.
The docs on the function itself mentions briefly that it could block if VSync is enabled in the system - what does this mean? How would I enable it?
Setting the swap interval is specific for the window manager in OpenGl. In the case of GLFW, you need to call glfwSwapInterval. Unfortunately, you cannot do it yourself in GPipe since the thread your ContextT is running on doesn't have the GL context current. This should really be implemented in GPipe-GLFW's context creation instead, i.e. inside newContext'.
And no, you cannot asynchronously swap the buffers in GPipe (but you wouldn't want to do that even if it was possible).