with the StatsHandler. When the 's' key is pressed, the rendering
window will be halted. I tried solving the problem by commenting a
line in CMFC_OSG_MDIView::OnKeyDown() and it seems to work now.
Another improvement here is to use a thread class derived from
OpenThreads to replace the old _beginthread(). It helps a lot in
keeping a high frame rate when you open more than one MDI child
windows. And the application using OpenThreads in my opinion will be
more compatible and portable."
Attached the modified version of MFC_OSG_MDIView.cpp and MFC_OSG_MDIView.h."
Note from Robert Osfield, submission came with wrong header file, so have had
to guess at what it should be, fingers crossed it worn't break windows build... :-)
Changes:
MFC_OSG.cpp:
Removed pixelformatdesciptor from the class initialization.
Used setInheritedWindowPixelFormat to true so it will setup the pixelformat for the window.
Added class destructor code.
MFC_OSG.h:
Removed the ref_ptr on osgViewer::Viewer
MFC_OSG_MDIViewer.cpp:
Changed the OnDestroy function code.
Added WaitforSingleObject with thread handle for the MFC render handle.
MFC_OSG_MDIView.h:
Added class variable for MFC Render Thread Handle for use with the WaitforSingleObject.
"
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
"