From e88ddf55c7fce7c1e12901a183d7fb87e2526ad2 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 2 Mar 2019 02:33:30 +0100 Subject: [PATCH] reduce flicker on iOS --- PanoPainter/GameViewController.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/PanoPainter/GameViewController.m b/PanoPainter/GameViewController.m index 00c4f75..51ce52c 100644 --- a/PanoPainter/GameViewController.m +++ b/PanoPainter/GameViewController.m @@ -468,16 +468,17 @@ std::set ignored_touch; App::I.tick(dt.count()); - [self async_lock]; if (!(App::I.redraw || App::I.animate || !working_list.empty())) { - [self.context presentRenderbuffer:GL_FRAMEBUFFER]; - [self async_unlock]; + //[self.context presentRenderbuffer:GL_FRAMEBUFFER]; + //[self async_unlock]; + //[self->glview display]; std::unique_lock lock(render_mutex); render_cv.wait(lock); continue; } + [self async_lock]; while (!working_list.empty()) { working_list.front()(); @@ -486,8 +487,8 @@ std::set ignored_touch; App::I.clear(); App::I.update(elapsed); [self.context presentRenderbuffer:GL_FRAMEBUFFER]; - [self async_unlock]; [self->glview display]; + [self async_unlock]; elapsed = 0; } } @@ -503,7 +504,7 @@ std::set ignored_touch; }).detach(); displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(tick)]; - displayLink.frameInterval = 4; + displayLink.frameInterval = 1; [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; }