views:

666

answers:

2

I'm writing a flood-fill algorithm...it needs to paint individual pixels. What's the fastest way to do this? At first I thought of using cocos2d's drawpoint, but having 320 * 480 vertices doesn't sound too good. Is there a faster way using memset or something?

+1  A: 

If you're going to be covering most of the screen (or most of some known sub-rectangle of the screen), then the fastest way will probably be to create a screen-size (or sub-rectangle sized) texture. Fill the whole thing in software (transparent alpha for pixels you don't want to draw), and then dynamically update it whenever it changes.

I haven't done much iPhone work, but I expect that would be faster than trying to draw 100,000 primitives (of any type) each frame.

Alan
A: 

Se Apple's GLImageProcessing sample app. It should be very helpful.

I skipped that and did my image processing via bitmaps. Not sure if that would help you though.

mahboudz