So far I determined that my largest brush texture causes performance to drop after 2500 vertices have been drawn with it, and my smallest texture can go 110000 vertices. I have implemented a scheme where the verts are calculated after every draw, and if they exceed these predetermined numbers (using a percentage of max verts), I put all the elements on screen into a backup array, take a UIImage snapshot of the canvas, clear the canvas, and then display the snapshot on a UIImageView which sits just below the metal view. Since the metal canvas is now empty, performance is maintained. I feel this is a horrible solution but it is the only thing my mediocre coding brain could come up with. The UIImage snapshot displays a little darker than the metal view, so when the change happens, there's a noticeable jarring switch. It works, but it's ugly. I wish I knew how the Procreate developers are able to maintain such solid and smooth performance in their drawing app. I'm open to suggestions on how to better handle this scenario.
Topic:
Graphics & Games
SubTopic:
General
Tags: