Ari Braginsky
Ari Braginsky

Reputation: 926

iPhone camera images as OpenGL ES textures

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?

Upvotes: 2

Views: 2830

Answers (2)

Till
Till

Reputation: 27587

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.

Upvotes: 0

Nils Pipenbrinck
Nils Pipenbrinck

Reputation: 86313

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.

Upvotes: 4

Related Questions