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”