From 69b16d33db03d673b298ba00383f9254b71dac29 Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh <40482367+khanhduytran0@users.noreply.github.com> Date: Wed, 6 Jan 2021 17:52:01 +0700 Subject: [PATCH] Trying to fix second draw frame crashes Yay it almost works! First frame rendered! (rd-132211) --- Natives/ViewController.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Natives/ViewController.m b/Natives/ViewController.m index dd8d4b00..03effe02 100644 --- a/Natives/ViewController.m +++ b/Natives/ViewController.m @@ -46,11 +46,23 @@ - (void)setupGL { [EAGLContext setCurrentContext:self.context]; + self.paused = YES; + glClearColor(0.1, 0.1f, 0.1f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + + CGRect screenBounds = [[UIScreen mainScreen] bounds]; + CGFloat screenScale = [[UIScreen mainScreen] scale]; + + int width_c = (int) roundf(screenBounds.size.width * screenScale); + int height_c = (int) roundf(screenBounds.size.height * screenScale); + glViewport(0, 0, width_c, height_c); + + callback_AppDelegate_didFinishLaunching(width_c, height_c); } #pragma mark - GLKView and GLKViewController delegate methods - +/* int called = 0; - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect { @@ -61,5 +73,5 @@ int called = 0; self.paused = YES; } } - +*/ @end