views:

1953

answers:

4

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.

+2  A: 

Why don't you use OpenGL views?

Mehrdad Afshari
A: 

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.

joshperry
+3  A: 

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.

codelogic
+2  A: 

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.