GLKTextureLoader 完成处理程序 EXEC_BAD_ACCESS 问题
我可以使用 GLKTextureLoader 加载纹理,但是当我尝试在单独的线程上加载纹理时,我遇到了 EXEC_BAD_ACCESS 问题。
工作代码。
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 );
}
失败的代码。
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;
}
}];
附加信息。 在completionBlock正在运行的线程上,我通过以下方式获得EXEC_BAD_ACCESS
有人设法让它工作吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论