The fastest way to display a pixel raster on iOS devices

I'm wondering what is the fastest way to visualize a pixel raster from memory to the screen of iOS devices to achieve the highest possible frame rate. I can imagine two approaches:

  • Create a CGImage with a CGImageCreate, draw it on the screen using the CGContextDrawImage in the drawRect method, and then delete the CGImage object
  • Use OpenGL in spelling mode, copy the pixels into the texture using glTexImage2D and create a square with this texture

Probably the second approach will be faster than the first. But will it be much faster or slightly? And is there a third way to do this that will be faster than the first two that I mentioned?

+3
source share
1 answer

If your image is updated frequently, creating a texture every frame (or almost every frame) will be quite successful. Perhaps you are lucky with the help CALayerand set its contents to the CGImageRefone you want to use. The result will be similar to the use CGContextDrawImage()as you described, but provides Core Animation with more flexibility in rendering, hoping to make it faster.

0
source

Source: https://habr.com/ru/post/1777267/


All Articles