Commit Graph

8 Commits

Author SHA1 Message Date
Robert Osfield
5162fcc108 From Wang Rui, "I've encountered a strange problem that osgviewerMFC doesn't work well
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."
2011-09-12 10:47:59 +00:00
Robert Osfield
e601bb9cc3 From Wang Rui, "For a long time, the osgviewerMFC example uses addSlave() to setup the
graphics context and link it with a slave camera. I don't know the
reason we perform like that, which will cause a problem that the
GUIEventHandler may not obtain correct window coordinates because the
main camera will use a default input range to receive events from the
slave camera's graphics context. It is also weird to see the
addSlave() used in non-cluster applications, which beginners will be
confused with.

I've make a slightly modification to the osgviewerMFC example to make
it work without setting slave cameras. I've tested with the MDI
framework and everything seems fine."
2010-06-14 15:25:05 +00:00
Robert Osfield
b93581e687 From Cory Riddell, fix for aspect ratio 2009-04-08 14:08:16 +00:00
Robert Osfield
fee5bc9f8c From Michael Hartman, "Here is an update for the closing issue with the example osgviewerMFC where the MFC rendering thread would not exit before the application and the thread would be left running in the background and the user would have to use TaskManager to kill the process.
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.
"
2007-07-23 20:37:49 +00:00
Robert Osfield
c913f00d21 From Michael Hartman, "CMakeLists.txt:
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

"
2007-06-01 21:28:18 +00:00
Robert Osfield
95e77d02ec From Michael Hartman, "I have made a small change to the osgviewerMFC application that resolved most of my home computer issues. It seams that my home computer needed to have the pixel format set with PFD_DOUBLEBUFFER.
Also,  with the cmake ability you are free to remove the MFC_OSG_MDI.vcproj file.
"
2007-05-19 12:27:53 +00:00
Robert Osfield
7f1cb32fc1 From Michael Hartman, "I have gone in and created a CMakeList.txt file for osgviewerMFC application.
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.

 

"
2007-05-17 11:04:57 +00:00
Robert Osfield
4eb8427327 From Michael Hartman, " Here is the MFC_OSG example. It is very basic and the community is welcome to enhance/improve this example. There is one bug documented in the Readme.txt file that I just have not had time to solve. Also, the code is built outside of the OSG environment and uses environment variables to get to the OSG distribution headers and examples. That should be the only change a user needs to make to get the code to compile." 2007-05-11 08:19:46 +00:00