What is the fastest way to draw single pixels directly to the screen in an iPhone application?

╄→尐↘猪︶ㄣ 提交于 2019-12-30 04:58:09

问题


I am looking the fastest way to draw thousands of individually calculated pixels directly to the screen in an iPhone application that preforms extremely well.


回答1:


Most probably using OpenGL, something like:

glBegin(GL_POINTS);
glColor3f(...);
glVertex3f(...);
...
glEnd();

Even faster would probably be to use vertex arrays for specifying the points.




回答2:


Why don't you use OpenGL views?




回答3:


In all graphics frameworks I've ever used, the way you'd do this is to write your pixels into a block of memory (in ARGB or RGBA format for example), and then push the whole block of memory to the graphics subsystem. No "draw one point" API can possibly be fast, if you want to draw thousands of pixels quickly you need to push an image/texture/bitmap/whatever-you-want-to-call-it, rather than pushing individual points one at a time.




回答4:


I would create a BMP the size of the view, add it to the view and draw into the BMP. Cocoa doesn't have any way to draw a single pixel to a view, other than faking it by using a line with a length of 1 pixel like this Question mentions.



来源:https://stackoverflow.com/questions/389289/what-is-the-fastest-way-to-draw-single-pixels-directly-to-the-screen-in-an-iphon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!