I'm using cpp/marmalade to make a game for ios, but sometimes textures render corrupted. Here is the source texture file:
Example of a currupted texture:
I'm loading texture with this code:
VGTexture2D* VGTextureLoader::loadImage(std::string imagefile)
{
CIwImage img;
img.LoadFromFile(imagefile.c_str());
// Convert to an OpenGL ES native format
CIwImage nativeImg;
nativeImg.SetFormat(CIwImage::ABGR_8888);
img.ConvertToImage(&nativeImg);
// Generate texture object
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
// Upload
uint32 width = img.GetWidth();
uint32 height = img.GetHeight();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nativeImg.GetTexels());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// Create and return texture
VGTexture2D* tex = new VGTexture2D(texture, (float)width, (float)height);
return tex;
}