I’m very new to OpenGL, so I’m sorry if this may be very basic (or not make sense).
I’m working on a 2D game in which there are a lot of sprites whose size are not powers of two. So I’ll have textures like, say, 520×260, and which cannot be redesigned. Now my understanding is that since OpenGL ES 1 needs textures to be powers of two, I’ll effectively be wasting a lot of memory (since the texture in my previous example would actually take up 1024×512 on the hardware).
What I’ve been thinking was that instead of having the sprite be two triangles with that one large texture, I could maybe have the sprite be made up of more smaller triangles, and that I could break down to large texture in smaller pow2 chunks (say 128×128) which could be used separately on those triangles (using something like a grid map).
So my question is: is it possible and feasible to use multiple textures for a single mesh? And if so, would the extra calculations (necessary for all the smaller triangles and texturing them) be worth the texture memory save?
P.S. I am working on Android, but I don’t suppose that makes much difference.
Absolutely you can and should do this to save memory. The only thing you need to worry about is your UV-mapping. You will have to adjust your UV coordinates based upon how you arrange your mesh.
For example, say you wanted to stuff three textures in a 128×128 mesh:
If you wanted to map each texture, your UV-coordinate ranges are as follows:
You will have to translate these accordingly onto your vertices.