Re: Throttling drawing to vertical refresh

2020-10-23 Thread Gabriel Zachmann via Cocoa-dev
> >>> So is there a convenient way to throttle drawing to the monitor's refresh >>> rate or does this have to be done the hard way by querying the monitor's >>> refresh rate and then setting up a timer which draws in exactly those >>> refresh intervals or how should this be done? > >>> Note th

Re: Throttling drawing to vertical refresh

2020-10-23 Thread David Duncan via Cocoa-dev
> On Oct 23, 2020, at 8:54 AM, Andreas Falkenhahn > wrote: > > Thanks, but once again, I still need a throttle because I obviously don't > want to call -setNeedsDisplay as often as the CPU permits, thereby causing > 100% CPU load. I still need some timer mechanism that only calls > -setNeeds

Re: Throttling drawing to vertical refresh

2020-10-23 Thread Andreas Falkenhahn via Cocoa-dev
Erm, but I obviously need to update the screen more often than every second. I don't understand why I should be using an update time of 1 second. I obviously need to call "setNeedsDisplay" more often than that... On 23.10.2020 at 18:09 Alex Zavatone wrote: > Naaah, it’s not that. The OSes draw

Re: Throttling drawing to vertical refresh

2020-10-23 Thread Alex Zavatone via Cocoa-dev
Just try the simple code I supplied with a 1, 2, second update time. If you find that it doesn’t work, it’s 5 minutes spent. If you find that it does, just figure out the update time that you want. 1/2 a second? 1/10 of a second? The other thing you can have is a “hasTheDataChanged” setting

Re: Throttling drawing to vertical refresh

2020-10-23 Thread Alex Zavatone via Cocoa-dev
Naaah, it’s not that. The OSes draw code already handles that at a much lower level. You’re just creating what is a maximum update throttle. You’re not blitting pixels in a video card driver. You can try my simple approach and just declare the next update time to be the current time + 1 seco

Re: Throttling drawing to vertical refresh

2020-10-23 Thread Andreas Falkenhahn via Cocoa-dev
Thanks, but once again, I still need a throttle because I obviously don't want to call -setNeedsDisplay as often as the CPU permits, thereby causing 100% CPU load. I still need some timer mechanism that only calls -setNeedsDisplay every once in a while. So should I setup a timer based on the mon

Re: Throttling drawing to vertical refresh

2020-10-23 Thread Andreas Falkenhahn via Cocoa-dev
The problem with that approach is that I'd need to find out the monitor's refresh rate in order to calculate "nextUpdateTime" and I'm not sure if I can get this information from all monitors reliably. On 19.10.2020 at 00:09 Alex Zavatone wrote: > It shouldn’t be too hard to roll your own simply