Hello friends,
I am building an augmented reality application using vuforia and irrlicht.Vuforia is used for image recognition and provides me with the model view projection matrix of the image.I use that to draw 3D models on the image using irrlicht.I have almost completed all the functionalities of this application.I am just left with one last problem.Once the image is detected,I initialize the irrlicht device and try loading the scene.During that period my app freezes till the scene is loaded.So, I tried to run the initialization and scene loading process on a separate thread.But,its not working.The app still freezes.I am working on ios.I am pasting the code snippet from my project below.Please help me to solve this.
dispatch_async(dispatch_get_main_queue(),^(void){
[self Initiate];});//Initiate function is used to initialize irrlicht on a separate thread
-(void)Initiate
{
SIrrlichtCreationParameters param;
param.DriverType = EDT_OGLES2;
param.WindowSize = dimension2d<u32>(0,0);
param.WindowId = self;
param.Bits = 32;
param.ZBufferBits = 16;
param.AntiAlias = 0;
param.PATH="";
//For equating buffers of vuforia and irrlicht
param.defaultFramebuffer=defaultFramebuffer;
param.colorRenderBuffer =colorRenderbuffer;
param.depthRenderBuffer=depthRenderbuffer;
param.frameBufferWidth=framebufferWidth;
param.frameBufferHeight=framebufferHeight;
cp::view=self;
cp::Device=createDeviceEx(param);
cp::Device->getSceneManager()->loadScene("abc.irr");//loads the irr file
}
multithreading in irrlicht on ios
Re: multithreading in irrlicht on ios
You can't render until the scene is loaded, so there will be nothing visible until the scene is loaded. This is nothing to do with multiple threads, it is simply common sense. Commercial applications use a splash screen to hide the loading.
Re: multithreading in irrlicht on ios
Hey Mongoose7
As you can see in the above code, I am not rendering before the scene gets loaded. I just want that my app should not hang. i.e. The camera scene which was being displayed before image recognition should continue smoothly. But what happens is that the camera scene hangs. Then after everything gets loaded, the app resumes.
As you can see in the above code, I am not rendering before the scene gets loaded. I just want that my app should not hang. i.e. The camera scene which was being displayed before image recognition should continue smoothly. But what happens is that the camera scene hangs. Then after everything gets loaded, the app resumes.