Changed this back to setup_example since WIN32 flag is now supported.
MFC_OSG.h:
Added flag to indicate when the rendering thread has exited.
MFC_OSG.cpp:
Code modifications to support rendering flag thread exit.
MFC_OSG_MDIView.cpp:
Change to OnDestroy function to wait until we get render thread exit flag is true before we close the window.
Main Exit Process:
User presses escape button
Viewer captures escape button and stops threading etc.
Viewer sets Done when shutdown is complete
MFC Render Thread monitors viewer->done for true
MFC Render Thread exits while loop and sets MFC Done flag
MFC View Window monitors MFC Done flag and then closes/destroys the window
"
Below is the changes made to the included files. The examples CMakeList.txt file was not included but the code change needed for osgviewerMFC inclusion is listed below.
CMakeList.txt:
This is a little different than other example cmakelist.txt files in that I could not use the setup_example macro. I had to go in and extract out the important parts of the macro and inline them in the CMakeList.txt file so that I could add the WIN32 declaration into the ADD_EXECUTABLE() statement. In the future the setup_example macro might be modified to support osgviewerMFC but this is special case so you might not want to muddy the water for one example.
MFC_OSG.h:
This file had some small changes:
From: #include <osgViewer/GraphicsWindowWin32>
To: #include <osgViewer/api/win32/GraphicsWindowWin32>
Also added two new function declarations
Void PreFrameUpdate(void);
Void PostFrameUpdate(void);
MFC_OSG.cpp:
This file changed only in that I am explicitly showing the viewer run loop and added the two new functions in the MFC_OSG.h file.
"