0
我在通過加載紋理方法加載紋理時遇到了問題。GLKTextureLoader只能加載一個紋理
+(Texture*) loadTexture: (NSString*) name path: (NSString*) path{
CGImageRef imageReference = [[UIImage imageNamed:path] CGImage];
GLKTextureInfo* textureInfo = [GLKTextureLoader textureWithCGImage:imageReference options:nil error:NULL];
Texture* texture = [[Texture alloc] init:textureInfo];
NSLog(@"width: %i height: %i data: %p", [texture Width], [texture Height], [texture getTextureInfo]);
if(!Textures) Textures = [[NSMutableDictionary alloc] init];
[Textures setObject:texture forKey:name];
NSLog(@"adding key %@ to dictionary with pointer %p", name, Textures);
NSLog(@"%@", Textures);
return texture;
}
我第一次調用load紋理的方法都很好,但任何後續調用加載紋理textureInfo未能被初始化和NSLog的顯示「寬度:0高度:0數據:爲0x0」