I'm using GLKLoadTexture to load an atlas into my OpenGL based application.
When I load the texture on a device with iOS 10 (iPad mini Retina, iPhone 7) the colors show up exactly as they are in the PNG. But when I load it on an older device on iOS 9 or lower (iPod touch 5G, iPad 2), the red and blue channels are flipped!
This happens on the Simulator as well when I choose the respective iOS versions for any (64 bit or 32 bit) device.
Here's my texture loading code:
UIImage *imageRef = [UIImage imageNamed:@"TextureMap"];
GLKTextureInfo *_texture = [GLKTextureLoader textureWithCGImage:imageRef.CGImage options:nil error:&error];
if(error)
{
NSLog(@"Texture Error:%@", error);
}
glBindTexture(GLenum(GL_TEXTURE_2D), _texture.name);
After this, the code is handed over to C++ to do the rest (the program only uses a single texture), but I encountered this same problem in a Swift-based application as well with similar code.