I am able to load a texture using the GLKTextureLoader however when i try to do it on a separate thread i get an EXEC_BAD_ACCESS issue.
working code.
NSError *error;
GLuint textureName = self.textureImageInfo.name;
glDeleteTextures(GL_TEXTURE_2D, &textureName);
self.textureImageInfo =
[GLKTextureLoader textureWithCGImage:imageRef options:nil error:&error];
if( error )
{
NSLog(@"Image loading error. %@", error );
}
Failing code.
self.textureLoader =
[[GLKTextureLoader alloc] initWithSharegroup:_context.sharegroup];
[self.textureLoader textureWithCGImage:imageRef options:nil queue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0) completionHandler:^( GLKTextureInfo *textureInfo, NSError *error)
{
if( error )
{
NSLog(@"Image loading error. %@", error );
return;
}
}];
Additional info.
On the Thread that the completionBlock is running is where i get the EXEC_BAD_ACCESS with the following
Has anyone managed to get this to work?