I am having an issue loading in textures through a load texture method.
+(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;
}
The first time I call the load texture method all is well, but any subsequent calls to load texture the textureInfo fails to be initialized and the NSLog shows "width: 0 height: 0 data: 0x0"
I figured out why it wasn't working and here is a link to the answer https://stackoverflow.com/a/13948618/7914426