I am new to 3d programming, however after a few days of learning Blender and watching the wonderful tutorials for SIO2 - I was able to get a demo up. Currently I have a Sphere with a an earth texture mapped to it. It displays fine and I am able to rotate it with finger and accelerometer on the iphone. I would like to be able to switch the texture via code in real time. For example, if I tap the screen, I want to switch the "earth" texture with a "mars" texture. Is it possible to swap texture in real time on the same object? Can someone please point me in the direction to accomplish this? Do I need to set this up in blender and export? Or can I place another texture in my project and call some SIO2 function to swap out the texture on the object?

Take note that I had a constraint that the image was loaded from the iPhone's memory, so I really had to do this in runtime. In your case, it seems like you have access to the new texture image (mars) at compile time, which may open other options for you, like doing it in blender somehow (can't help you here, sorry).

However, it's useless in my code, since I'm not transforming the object in any way (rotation, translation, etc.). You can remove it and replace that instruction with "sio2ImageGenId(_SIO2material->_SIO2image[0], _SIO2material->tflags[0], _SIO2material->tfilter[0]);", which I forgot to add on my initial code.

Thank you so much! it works great! I guess I just have to consider what you told me initially. I know all the possible textures I will need at compile time, so your dynamic method might be over kill, but maybe your method uses less memory?

Based on the code it looks like it just overwrites the original texture with the new one, so technically I can swap out unlimited textures with this method correct? I do notice a slight pause when swapping, but this is ok for my needs.

Yes, you can swap the texture as many times as you want, since it basically overwrites the previous texture. My opinion is that you need to weight the importance of memory consumption and cpu usage of your application, in order to decide what method to use. If you have plenty of memory, load all the textures initially and swap them in memory (or do that via blender - don't ask me how though). If memory is a concern, then use my code to swap textures.

If you expect to load the same textures multiple times during an execution of the application, I think you should consider somehow keeping the image in memory. You can maybe keep the SIO2Image objects in memory...