For my application, timing is quite critical. I need to know when exactly the buffers are swapped.
First I was thinking to use glfwGetTime() and just keep track of the time, however in no way this guarantees a high accuracy; you might be off by a few miliseconds or something.
Hence, I was thinking that it would be awesome if there is a callback, which is called everytime the buffers are swapped. However, after looking in the GLFW documentation, googling and looking through many posts, I haven’t found anything I could use.
My question, thus, is: is there such a callback (I fear not), and if not, what else can I do to have an accurate estimation when the buffers are swapped?
GLFW’s buffer swapping simply wraps the OS OpenGL buffer swap API, and this has no callback with the actual time the buffers are swapped - indeed there’s no guarantee that the swap is even complete after the call has returned.
In order to get timing details, you could use OpenGL timer queries - placing one before the swap would allow you to query when it occurred.
Yeah, I was already playing around with timer queries. The problem was that it is not that accurate (in the sense that each frame is timed slightly differently). Hence, I thought a callback would be the most accurate way. Guess I will have to continue with the timer queries then.