【问题标题】:GLKTextureLoader is only able to load one textureGLKTextureLoader 只能加载一个纹理
【发布时间】:2017-06-19 23:09:36
【问题描述】:

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

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

我第一次调用加载纹理方法一切正常,但是任何后续调用加载纹理的纹理信息都无法初始化并且 NSLog 显示“宽度:0 高度:0 数据:0x0”

【问题讨论】:

    标签: ios objective-c opengl-es glkit glktextureloader


    【解决方案1】:

    我知道为什么它不起作用,这里是答案的链接https://stackoverflow.com/a/13948618/7914426

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-26
      • 1970-01-01
      • 2013-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多