开发者

CVDisplayLink instead of NSTimer

开发者 https://www.devze.com 2022-12-11 15:50 出处:网络
I have started to implement cvDisplayLink to drive the render loop instead of nstimer, as detailed in this technical note https://developer.apple.com/library/archive/qa/qa1385/_index.html

I have started to implement cvDisplayLink to drive the render loop instead of nstimer, as detailed in this technical note https://developer.apple.com/library/archive/qa/qa1385/_index.html

Is it better to do the actual rendering within the displaylink callback itself, or should I instead call setNeedsDisplay on the view and let the main thread do the rendering?

In order to render di开发者_开发知识库rectly in the callback, I need to lock the opengl context, which I was hoping to avoid.

Is it possible to use cvDisplayLink for timing and still render on the main thread?

Thanks in advance for any feedback....


There’s no intrinsic problem with locking the context; it should be uncontended and unlock quickly. Redrawing on the main thread, via -setNeedsDisplay:, has a chance of missing the VBL window just because of the runloop round-trip.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号