Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Dear experts,
I want to design a graphical editor using Irrlicht engine! My software is divided into two parts. One user interface and second is a window which Irrlicht uses to draw on it! I want to use separate threads to avoid from interfering of GUI in Irrlicht drawing loop! Now i need to know which kind of thread i should use for each one!(Worker and UI Threads). I have used MFC platform!

void Irrlicht_Main_Process()
{
   while(true)
   {
      //Draw anything here
   }
   return true;
}


Best regards
Posted
Updated 2-May-10 0:34am
v4

We'd need to know some more about the architecture of your project to give a really meaningful answer here. But on first examination, threading may not be such a good idea.
Since it seems clear that you want to do user interface stuff in both parts of your program, you should stick to the following general rules:

Do not access user interface objects from a thread different than the one in which the object was created.
If you want to communicate with a user interface object in another thread, do so through the normal message loop, so use send_message or post_message.
 
Share this answer
 
Before even staring multithreading programming with MFC, please read the Dr.Newcomer's articles about, for instance "Using User-Interface Threads" and "Using Worker Threads".
:)
 
Share this answer
 
Do you want to embed your Irrlicht scene into an MFC window ? If yes, I suggest that you render the Irrlicht scene by overriding the CWinApp::OnIdle[^] method of your application class.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900