Ios 使用nineveh gl frsmework更改纹理
如果我试图更改另一个纹理,而上一个纹理仍在进行中,则应用程序将崩溃 这是我的密码 -IBActionchangeTexture:idsender{Ios 使用nineveh gl frsmework更改纹理,ios,Ios,如果我试图更改另一个纹理,而上一个纹理仍在进行中,则应用程序将崩溃 这是我的密码 -IBActionchangeTexture:idsender{ self.text = [arrayEyes objectAtIndex:[sender tag]]; NGLTexture *texture; texture = [NGLTexture texture2DWithFile:self.text]; NGLMaterialMulti *material = (NGLMaterialMulti *)m
self.text = [arrayEyes objectAtIndex:[sender tag]];
NGLTexture *texture;
texture = [NGLTexture texture2DWithFile:self.text];
NGLMaterialMulti *material = (NGLMaterialMulti *)mesh.material;
[[material materialWithName:@"lambert16SG"] setDiffuseMap:texture];
mesh.material = material;
[mesh compileCoreMesh];
}我将假设此代码在程序执行的开始就被命中。因此,有一段时间,模型仍在后台线程中加载 因此,NGLTexture很可能在另一个线程中处理时被指定给网格的材质。您可能会遇到分配问题,这将引发异常或彻底崩溃。尝试等待模型加载器完成处理,然后再对其进行分配。查找NGLMeshDelegate协议,并尝试在-meshLoadingDidFinish:handler中进行赋值。这可能会有所帮助