- Home /
Determine exact timing of screen refresh / flip
I'm trying to sync up what happens on my screen to an external device. Currently, I make a call to DateTime.UtcNow in the OnGUI() function of my gui object. I'm wondering about the accuracy of such an approach. It would be great if there was some way to get a precise timestamp right after the low level OpenGL SwapBuffers call.
Answer by yoyo · May 30, 2011 at 06:50 PM
You could try OnPostRender and/or WaitForEndOfFrame, but it's always going to be hard to know precisely when the user actually sees the pixels you render, since you don't know what the display driver and display hardware are actually doing.
there are ways to query the graphics driver for the actual time it took to complete the buffer swap, but that is very low level stuff. Thanks for pointing me to WaitForEndOfFrame, it's good enough for my purposes.
Your answer
Follow this Question
Related Questions
how well does unity work for turn-based game time-type? 3 Answers
Time.deltaTime does not always correctly display the time difference between 2 frames 1 Answer
rotation synced to dspTime? 0 Answers
Precise timing of user responses 2 Answers
How do I make the code wait until animation has ended? 1 Answer