Keep updating while dragging/resizing?


#1

How can I setup OF or GLFW so that the main thread isn’t stopped when I drag or resize the window? I’m on Windows by the way.


#2

good question! I have some physics code where I’m passing the time difference to all update functions and when the App doesn’t get updated for a sceond because I drag the window, weird things happen :smiley:


#3

Try using ofGetSystemTimeMicros instead, should be independant of your application’s elapsed time


#4

This doesn’t work either. The problem really is that when I drag or resize the window neither the update() nor the draw() function is called back and the ofGetElapsedTime functions return the real time and not the logical time. I’m measuring the time difference between frames and when I move the window for a couple of seconds I get a huge delta time and this blows up my physics in my game (like the collision detection). My workaround is to clamp the delta time to some sane maximum value depending on my target frame rate.

Ideally I want the app not to pause at all when I just drag or resize the window.
@arturo is there a way to accomplish this?


#5

Here’s a GLFW callback that may help, glfwSetRefreshCallback, check this thread

https://github.com/glfw/glfw/issues/472