[英]GLKTextureLoader loads nothing, with no errors
這段代碼記錄了UIImage的寬度,但是加載的紋理的寬度為0:
NSDictionary * options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES],
GLKTextureLoaderOriginBottomLeft,
nil];
NSError * error;
UIImage * iu = [UIImage imageNamed:fileName];
CGImageRef cg=iu.CGImage;
NSLog(@"image size width: %f", iu.size.width);
self.textureInfo= [GLKTextureLoader textureWithCGImage:cg options:options error:&error];
if (self.textureInfo == nil) {
NSLog(@"Error loading file: %@", [error localizedDescription]);
return nil;
}
NSLog(@"texture width: %f", self.textureInfo.width);
如果最后一條日志行顯示0
那我在做什么錯? 沒有記錄錯誤。
問題在於日志記錄,而不是紋理加載。 它是一個int
:
NSLog(@"texture width: %i", self.textureInfo.width);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.