reduce flicker on iOS

This commit is contained in:
2019-03-02 02:33:30 +01:00
parent a4de6c9cc2
commit e88ddf55c7

View File

@@ -468,16 +468,17 @@ std::set<UITouch*> ignored_touch;
App::I.tick(dt.count()); App::I.tick(dt.count());
[self async_lock];
if (!(App::I.redraw || App::I.animate || !working_list.empty())) if (!(App::I.redraw || App::I.animate || !working_list.empty()))
{ {
[self.context presentRenderbuffer:GL_FRAMEBUFFER]; //[self.context presentRenderbuffer:GL_FRAMEBUFFER];
[self async_unlock]; //[self async_unlock];
//[self->glview display];
std::unique_lock<std::mutex> lock(render_mutex); std::unique_lock<std::mutex> lock(render_mutex);
render_cv.wait(lock); render_cv.wait(lock);
continue; continue;
} }
[self async_lock];
while (!working_list.empty()) while (!working_list.empty())
{ {
working_list.front()(); working_list.front()();
@@ -486,8 +487,8 @@ std::set<UITouch*> ignored_touch;
App::I.clear(); App::I.clear();
App::I.update(elapsed); App::I.update(elapsed);
[self.context presentRenderbuffer:GL_FRAMEBUFFER]; [self.context presentRenderbuffer:GL_FRAMEBUFFER];
[self async_unlock];
[self->glview display]; [self->glview display];
[self async_unlock];
elapsed = 0; elapsed = 0;
} }
} }
@@ -503,7 +504,7 @@ std::set<UITouch*> ignored_touch;
}).detach(); }).detach();
displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(tick)]; displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(tick)];
displayLink.frameInterval = 4; displayLink.frameInterval = 1;
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
} }