Help with appViewController

I’m writing a video app and need the ability to capture the Corona view asynchronously (my captureScreen + display.save method was extremely inefficient.)

PROBLEM: Instead of capturing the Corona context, this code exports solid black jpgs at 750 x 1334.

 id\<CoronaRuntime\> runtime = (id\<CoronaRuntime\>)CoronaLuaGetContext( L ); CGRect rect = [runtime.appViewController.view bounds]; UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); [runtime.appViewController.view.layer renderInContext:context]; UIImage \*capturedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSString \*tmpDirectory = NSTemporaryDirectory(); NSString \*exportUrl = [tmpDirectory stringByAppendingPathComponent:"frame.jpg"]; [UIImageJPEGRepresentation(capturedImage, 1.0) writeToFile:exportUrl atomically:NO];

Any help is greatly appreciated.

Best,

Aidan

Hello! Corona uses OpenGL to render everything but native UI. “renderInContext:” wouldn’t work with it. There are various methods you can use to capture GLKView. Here’s a good summary.
In a nutshell, they are similar to those used in display.captureScreen().

*facepalm* that should have been obvious. Thank you Vlads for another helpful answer!

I (successfully) tried out 4 different solutions for rendering the openGL view, all of which were slower than display.captureScreen( ), so props to the Corona engineers.

Is there any way I can access the captureScreen API to instead pull the render as a native data or image object?

Edit: Or has anyone come up with an asynchronous display.save equivalent?

Hello! Corona uses OpenGL to render everything but native UI. “renderInContext:” wouldn’t work with it. There are various methods you can use to capture GLKView. Here’s a good summary.
In a nutshell, they are similar to those used in display.captureScreen().

*facepalm* that should have been obvious. Thank you Vlads for another helpful answer!

I (successfully) tried out 4 different solutions for rendering the openGL view, all of which were slower than display.captureScreen( ), so props to the Corona engineers.

Is there any way I can access the captureScreen API to instead pull the render as a native data or image object?

Edit: Or has anyone come up with an asynchronous display.save equivalent?