Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用nineveh gl frsmework更改纹理_Ios - Fatal编程技术网

Ios 使用nineveh gl frsmework更改纹理

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

如果我试图更改另一个纹理,而上一个纹理仍在进行中,则应用程序将崩溃

这是我的密码

-IBActionchangeTexture:idsender{

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中进行赋值。

这可能会有所帮助