Andrew, > I think you will find that not many people really dug into using MFC with > OSG ( as you can tell by the deafening silence on the forum on these topics)
Yes, indeed... > I am using a separate CMFC_OSG_MDIView for each CView. I am not sure why you > see that would be a problem. It does mean a separate Camera and separate > osgViewer::Viewer etc for each CView but as you can share > ,osg::Group/osg::Geometry objects as needed between scene graphs, I am not > sure why this would have any downside. OK, there's the difference. You're still using an osgViewer::Viewer instance per CMFC_OSG_MDIView, while on my side, I was trying to use one osgViewer::CompositeViewer to manage all the osgViewer::View inheriting the CMFC_OSG_MDIView window data. > The big difference between what I do and the OSG MFC examples is that > - I am single threaded I'm running a separate render thread. > I found that the osg threading mechanism seemed to be flawed, as I had 4 osg > threads using 100% of the CPU even when the app was idle. Perhaps I was > missing something. But it seems fundamental that , for example, the cull > thread is always running and never sleeping. Great for real-time games, not > so much for applications that need to be 'nice'. Could it be that you're using continuous rendering (default option) rather than on-demand rendering? You can change this with osgViewer::ViewerBase::setRunFrameScheme(osgViewer::ViewerBase::ON_DEMAND). The drawback is that you'll thus have to override the MFC stack to trigger osgViewer::View::requestRedraw() when required (e.g. OnSize). > - I then completely bypass the viewer OSG event handler and handle all > events using the standard MFC event mechanism. That is I handle OnPaint, > OnKeyDown,OnLButtonDown etc etc and do what is needed. For example, in my > OnDraw(CDC *cdc) I call viewer()->frame(); I had to do a couple of funky > things to get this to work properly . I can give you more details if you > want to go that way. I see. In this case, the above on-demand rendering trick won't work as ViewerBase::run() performs various tests in order to determine if osgViewer::ViewerBase::frame() should be called to redraw the display. Émeric _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org