In our app, we use a PNG sprite sheet where each sprite is just used as a mask. These are successfully loaded using GLKTextureLoader
. When iOS 7 reached the 5th/6th beta, something appeared to change in the way GLKTextureLoader
works, as suddenly all our PNGs started rendering incorrectly, as though there was something wrong with the alpha premultiplication.
After bug reports were submitted, and no response was received from Apple (and the problem is, worryingly, still present in the live release of iOS 7), we have decided to convert our PNGs to a PVR format.
When trying to load the PVR texture using GLKTextureLoader
:
NSDictionary *options = @{ GLKTextureLoaderOriginBottomLeft : @YES, GLKTextureLoaderApplyPremultiplication : @NO };
GLKTextureInfo *textureInfo = [GLKTextureLoader textureWithContentsOfURL:url options:options error:&error];
it fails with error 12 (GLKTextureLoaderErrorDataPreprocessingFailure
). What is involved in this 'preprocessing' step, and what could be the problem?
Here are some things I have checked:
.pvr
textureWithContentsOfURL:options:error:
, but nothing is logged (presumably GLKTextureLoader
is consuming the GL error, or the error is unrelated to OpenGL)This answer indicates that this can be caused by file corruption. This makes me wonder if I'm somehow generating the PVR incorrectly. I am using Imagination's PVRTexToolGUI to convert the PNG:
There are 2 versions of PVR file: the new and the legacy one. Try to save your PVR textures in different file format (save as legacy).