Continue drawing when loading a lot of resources?

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
WuZhenwei
Posts: 5
Joined: Fri Apr 18, 2014 11:08 am

Continue drawing when loading a lot of resources?

Post by WuZhenwei »

Hi
I'm worried about (though haven't came across yet) the problem that the main loop will be blocked when loading a lot of textures at a same time (when starting the game). I think I should use multithread, but I noticed Irrlicht is not multithread safe. Also in another post (below) greenya said only 'addTexture' and 'setMaterialTexture' should be synchronized. So that means I can run the main loop while using another thread to load some other textures and don't worry about any synchronization? Also he said if with OpenGL, I should call those two functions in the same thread I create the device. If so, maybe the best way to fit all platform is to use a new thread to run main loop and use the first thread (who has created the device) to load textures?
I didn't find much information in the document, so please help. Thanks
http://irrlicht.sourceforge.net/forum/v ... =1&t=46791
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Continue drawing when loading a lot of resources?

Post by mongoose7 »

The comments are technical. Generally, you can't load textures on the non-OpenGL thread. You can only do it if you separate the operations of loading the textures and of registering them with OpenGL. If you know how to do this, you should be right.
WuZhenwei
Posts: 5
Joined: Fri Apr 18, 2014 11:08 am

Re: Continue drawing when loading a lot of resources?

Post by WuZhenwei »

mongoose7 wrote:You can only do it if you separate the operations of loading the textures and of registering them with OpenGL.
Oh, I see. In fact I thought maybe I can use OpenGL in two threads before. So do you mean I can't do this and should instead use 'createImageFromFile' and 'addTexture'?
Thanks for your answer!
WuZhenwei
Posts: 5
Joined: Fri Apr 18, 2014 11:08 am

Re: Continue drawing when loading a lot of resources?

Post by WuZhenwei »

Also I hope I can use a single method in all devices, and will not have any problems if I need to change to another one.
Post Reply