I am writing a rendering program that needs to deal with a huge number of polygons, transforming them each frame and so on.
I intend to use several threads to do this:
Thread 1: This thread opens an openGL rendering window on creation which renders each model as it is processed for a frame.
Thread 2: This thread processes each model and the flags it to be drawn.
Thread 3: This postprocesses each frame and then saves it to disk.
There is also a central data-structure (a list of models) that all the thread will need to access.
The main program thread (which also handles the MFC user-interface stuff) needs to be able to communticate with each of the other threads, specifically it needs to set rendering options for the openGL window that is hidden inside thread 1. Thread 1 and 2 need easy access the the central list of models, and possibly to each other.
I guess I should use a UI thread for thread 1 and worker threads for threads 2 and 3. I have been trying to initialise thread 1 using AfxBeginThread, followed by WaitForSingleObject. WaitForSingleObject timesout, and then sending information to thread 1 doen't seem to work right. I haven't started on threads 2 or 3.
Can anyone give me any tips on how to create the underlying structure of this thread system, and how to check that threads are created right and how to comunticate between threads. I have been looking through the Visual C help, but it is all a bit dense.