Replacing textures...

So I’ve got an issue in that I’m binding three textures and it appears that whatever I bind first is there in the background of the second, and so on. So for example, if I have a ball with an alpha channel as texture[0], and a stick with an alpha as texture[1] and a background image as texture[2] then when I render the ball I see that just fine, then for the stick I see the stick and behind it I see the ball. The landscape is fine as it has no alpha but if I bind it first then I see the landscape instead of a transparent background throughout the others.

I thought to try to explicitly make sure I’m replacing the texture, but here’s how I’m loading the images, via a function deciding whether to create a mipmap and the texture index:

glGenTextures(1, &textures[texture]);
if ( mipmap)

Any ideas?? The only other thing I should mention is that this in on the iPhone and so there are a few quirks but most of these have been minor things like coordinate axes.

Got it - the memory wasn’t being zeroed out and so was being shared between the images.

calling memset after malloc zeroed out the memory and I’m done.

The following link was where I found the answer: