views:

1790

answers:

3

Is it possible to use an image captured with the iPhone's camera as a texture that is then manipulated in OpenGL ES (flag wave effect, etc.)? The main problem being the size of the iPhone screen being 320x480 (no status bar) and thus the image won't have dimensions that are power-of-2. Is the main option copying it into a 512x512 texture and adjusting the vertices?

+4  A: 

Yes, that's the way to do it.

Just use a larger texture. It's a waste of memory but unfortunately there is no way around this problem.

Nils Pipenbrinck
Thanks for the confirmation.
abraginsky
Does the iPhone OpenGL ES standard allow for the GL_ARB_texture_non_power_of_two extension? This may be worth looking into.
sludge
It does not @sludge
Till
A: 

An alternative would be deviding the picture into squares with a length and height of 32 pixels (aka tiling), resulting into 15x8 tiles. Displaying it would however involve many texture switches while drawing which might become a bottleneck. On the other hand you would save a lot of memory using a tiled approach.

Till
A: 

I am looking for using camera for iphone, and manipulate the image. However, using UIImagePickerController is very slow in grabbing and showing the image.

I am a beginner in usage of openGL. If I convert the image to a texture, how can i get a pointer to the image pixels and manipulate them?

Thanks,

Pannag