0

I am using GLKTextureLoader to load image textures into a sprite.

When I run the following code and load two sprites...

NSString *pathToImage = [NSString stringWithFormat:@"%@/defaultProject/images/%@", [Util applicationDocumentsDirectory], fileName];
NSLog(@"path: %@", pathToImage);
self.textureInfo = [GLKTextureLoader textureWithContentsOfFile:pathToImage options:options error:&error];
if (self.textureInfo == nil) 
{
    NSLog(@"Error loading file: %@", [error localizedDescription]);
    return;
}

... it fails for the first image but not for the second.

The error is:

Error loading file: The operation couldn’t be completed. (GLKTextureLoaderErrorDomain error 12.).

Does anyone know what this error means? I haven't found any information on code 12.

Thanks in advance!

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
Chris
  • 3,057
  • 5
  • 37
  • 63

1 Answers1

0

Error code 12 means GLKTextureLoaderErrorDataPreprocessingFailure as per (Apple Docs)

I think cause of error is a file corruption. Try to re-save your corrupted image.

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
Samet DEDE
  • 1,621
  • 19
  • 28
  • You are right. When I change the file and leave the filename equal it works. But I can open the file in preview? So it is definitely not corrupt?! The only difference is in the filesize. – Chris Jul 21 '12 at 10:05
  • File can be ok, but it can't processed by some reason. Re-saving same file should solve your problem. – Samet DEDE Jul 21 '12 at 20:52