How to export an image in full size in Metal

Hello dears,
I spent a lot of time on your fantastic book for Metal development and now I’m so excited working on my own project.
But now I have a problem that I didn’t find on book or googling it.

I have a MTKView and inside it I efficiently draw with my finger.
While the MTKView has a yellow cream background color, I set a white square which is my canvas.
In front of all there is an orthographic camera so I can zoom, translate and scale my canvas.

Now, the canvas is (for example) 2000x2000px but, obviously is rendered scaled on iPhone or iPad.
I would want to export the canvas and everything is rendered above it at the exact size of 2000x2000 without the MTKView’s background color.

raywend

Thanks!

Emanuele

Hi @oscar053 - welcome to the forums! I’m really glad you enjoyed the Metal book.

I haven’t done this recently, but I did find a few hints around the internet.

Uses Objective-C, but hopefully you can translate:

From this stackoverflow answer for movie recording, but the concept may help::

This is the complete sample

1 Like

Dear @caroline
I found very helpful your links and I solved the problem.
For future readers, I found interesting this Apple’s example.

https://developer.apple.com/documentation/metal/customizing_render_pass_setup?language=objc

I do not know how to thank you!

1 Like