Texture Minimum

I noticed before that when I used a 32x32 texture on a mesh object as its texture, there appeared some junk on the texture that should not be there. I'm not sure how to describe it other than, it was pink colored spots that appeared in the phone but not when looking at the texture in Photoshop or Preview.

I swapped it to a 64x64 and it worked fine for that 1 texture so I didn't worry about it.

Now, I have a particle system that I would really prefer to use a 32x32 or even 16x16 texture for the particle. I see the same problem with the 32x32 texture when the particles are rendering. Again, swapping it with a 64x64 texture fixes the problem but with a particle system, I'd be thankful if I could use a lower res texture.

Does anyone know if this is a known limitation with the iPhone as a texture minimum or is there something I can do to make this not happen with a filter or some other technique? Thanks in advance.

I've seen the same thing, and from my perspective, it actually makes sense. CGBitmapContextCreate simply takes an array of pixels (and some other stuff) and wraps it in a CGContext; it doesn't know whether or not there's already an image in the array of pixels you pass it, so it dares not clear the buffer. Compositing the pixels from a loaded image file is a draw operation, so it's a blend, not a replace. Transparent parts of your loaded image will then reveal any memory garbage that malloc left for you in the buffer from which you created your CGContext.

Yup. I ran into the same bug from using some of the early example code.

My guess is it has a lot to do with how malloc treats small or large allocations differently. Large allocations are going to get new sections of memory, while small allocations are more likely to get an already used section. Just a conjecture, but it sorta makes sense.