开发者

Force redraw with CADisplayLink

开发者 https://www.devze.com 2023-03-07 16:41 出处:网络
I\'m currently using CADisplayLink to show an OpenGL animation which work开发者_如何学Cs great. Sometimes, however a parameter changes and I need to redraw the view immediately and can\'t wait until t

I'm currently using CADisplayLink to show an OpenGL animation which work开发者_如何学Cs great. Sometimes, however a parameter changes and I need to redraw the view immediately and can't wait until the next frame is requested by CADisplayLink. If I don't do that, I get one frame wrong which looks really bad in my case.

So, how can I force a redraw of an EAGLView without interfering with the CADisplayLink stuff?


If your CADisplayLink is calling method drawFrame, for example, then just call drawFrame yourself when you need to. No reason you need to wait for CADisplayLink if you don't want to.


Your question suggests that you're storing your data in your view rather than in a data object. You should be able to change your data at any time, and your view should update when its needed to display. Move the data to a model object, and have the EAGLView draw itself based on the data when requested from the CADisplayLink rather than redrawing itself when the data changes.

0

精彩评论

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

关注公众号