GLKTextureLoader 只能加载一个纹理

GLKTextureLoader is only able to load one texture

我在通过加载纹理方法加载纹理时遇到问题。

+(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"

我弄清楚了为什么它不起作用,这是 link 的答案