multithreading in irrlicht on ios

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
anirban
Posts: 8
Joined: Mon Jan 27, 2014 4:48 am

multithreading in irrlicht on ios

Post by anirban »

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
}
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: multithreading in irrlicht on ios

Post by mongoose7 »

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.
anirban
Posts: 8
Joined: Mon Jan 27, 2014 4:48 am

Re: multithreading in irrlicht on ios

Post by anirban »

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.
Post Reply