0

我正在使用GLKTextureLoader将图像纹理加载到精灵中。

当我运行以下代码并加载两个精灵时......

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;
}

...第一张图片失败,但第二张图片失败。

错误是:

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

有谁知道这个错误是什么意思?我还没有找到关于代码 12 的任何信息。

提前致谢!

4

1 回答 1

0

错误代码 12 表示GLKTextureLoaderErrorDataPreprocessingFailure根据(Apple Docs

我认为错误的原因是文件损坏。尝试重新保存损坏的图像。

于 2012-07-20T21:02:15.400 回答