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 texture, все хорошо, но любые последующие вызовы для загрузки текстуры textureInfo не инициализируются, и NSLog показывает "width: 0 height: 0 data: 0x0"
1 ответ
Решение
Я понял, почему это не работает, и вот ссылка на ответ /questions/10401930/sboj-glktextureloader-pri-pervoj-zagruzke-opredelennoj-teksturyi-no-vo-vtoroj-raz/10401943#10401943