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;
}

В первый раз, когда я вызываю метод загрузки текстуры, все хорошо, но любые последующие вызовы для загрузки текстуры, textureInfo не инициализируется, и NSLog показывает «width: 0 height: 0 data: 0x0»


person Austin Twining    schedule 19.06.2017    source источник


Ответы (1)


Я понял, почему это не сработало, и вот ссылка на ответ https://stackoverflow.com/a/13948618/7914426

person Austin Twining    schedule 20.06.2017