- GLKTextureLoader cubemap fails with GLError 1281
- - (BOOL)loadTextures
- {
- // make sure EAGL context is active
- [EAGLContext setCurrentContext:self.context];
- /*
- Array of textures sorted as written in apple documentation
- Right(+x), Left(-x), Top(+y), Bottom(-y), Front(+z), Back(-z).
- Ref: http://developer.apple.com/library/ios/#documentation/GLkit/Reference/GLKTextureLoader_ClassRef/Reference/Reference.html#//apple_ref/occ/clm/GLKTextureLoader/cubeMapWithContentsOfFiles:options:error:
- */
- NSArray *texturesArray = @[
- [[NSBundle mainBundle] pathForResource:@"Right" ofType:@"png"], // +x
- [[NSBundle mainBundle] pathForResource:@"Left" ofType:@"png"], // -x
- [[NSBundle mainBundle] pathForResource:@"Up" ofType:@"png"], // +y
- [[NSBundle mainBundle] pathForResource:@"Down" ofType:@"png"], // -y
- [[NSBundle mainBundle] pathForResource:@"Front" ofType:@"png"], // +z
- [[NSBundle mainBundle] pathForResource:@"Back" ofType:@"png"], // -z
- ];
- NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:YES],
- GLKTextureLoaderOriginBottomLeft,
- nil];
- NSError *error;
- // load cubemap texture with given array of file paths
- self.cubemapTexture = [GLKTextureLoader cubeMapWithContentsOfFiles:texturesArray
- options:options
- error:&error];
- // if cubemapeTexture is null, loading failed
- if (nil == self.cubemapTexture) {
- NSLog(@"Failure reason: %@", error.description);
- NSLog(@"Error code: %i", error.code);
- NSLog(@"Textures: %@", texturesArray);
- NSLog(@"Error: %@", [error description]);
- @throw @"Can not load cubemap textures";
- } else {
- NSLog(@"Loaded cubemap textures '%@'n", self.cubemapTexture);
- }
- return YES;
- }
- ERROR: The operation couldn’t be completed. (GLKTextureLoaderErrorDomain error 8.)
- Failure reason: Error Domain=GLKTextureLoaderErrorDomain Code=8 "The operation couldn’t be completed.
- (GLKTextureLoaderErrorDomain error 8.)" UserInfo=0x886bee0 {
- GLKTextureLoaderGLErrorKey=1281,
- GLKTextureLoaderErrorKey=OpenGL error
- }
- Error code: 8
- Error loading cubemap texture (null)
- Textures: (
- "/ShortenPATH/Right.png",
- "/ShortenPATH/Left.png",
- "/ShortenPATH/Up.png",
- "/ShortenPATH/Down.png",
- "/ShortenPATH/Front.png",
- "/ShortenPATH/Back.png"
- )
- Error: Error Domain=GLKTextureLoaderErrorDomain Code=8
- "The operation couldn’t be completed.
- (GLKTextureLoaderErrorDomain error 8.)" UserInfo=0x886bee0 {
- GLKTextureLoaderGLErrorKey=1281, GLKTextureLoaderErrorKey=OpenGL error
- }
- *** Terminating app due to uncaught exception of class '__NSCFConstantString'
- terminate called throwing an exception