4

i am coding a 3d model viewer. but i can't have the texture.

everytime i try to run this code:

NSDictionary *options = @{  GLKTextureLoaderSRGB : @YES  };
NSError *error;
NSString *path = [[NSBundle mainBundle] pathForResource:@"1" ofType:@"png"];

GLKTextureInfo *texture = [GLKTextureLoader textureWithContentsOfFile:path options:options error:&error];


if(texture == nil){
    NSLog(@"error loading texture : %@", error.localizedDescription);
}

the texture is always nill. i tried with options:nil too. there is no error at image. it's 2048x2048 png. works ok with another application.

error is : GLKTextureLoaderErrorDomain error 12

it gives same error with another images.

solved.

the problem caused from png format. i changed image format to jpg and problem solved.

user3812138
  • 261
  • 4
  • 11

0 Answers0