Thank you Robert for your support, I forget to say that the problem is quite similar on run-time removing views.
Kind regards, 2008/6/23 Robert Osfield <[EMAIL PROTECTED]>: > Hi Alex, > > Thanks for the explanation. I'll reflect on this issue and hopefully > come up with a solution for automatically doing realize on new > windows. I won't be able to get to this right away though. > > Robert. > > On Mon, Jun 23, 2008 at 11:18 AM, amalric alexandre > <[EMAIL PROTECTED]> wrote: > > In fact I derived my application from the MFC exemple but with a > > compositeViewer in place of single Viewer, and when I receive a > NEW_WINDOW > > event in my CView::OnInitialUpdate() I add a new view to the composite > > viewer. It avoids to launch 2 times > > > > mThreadHandle = (HANDLE)_beginthread(&cOSG::Render, 0, mOSG); > > > > in MFC example and to have 2 single viewer. > > > > So in my app, when I add a new view, i create a new osgViewer::View with > > it's own GraphicsContext with a > > osgViewer::graphicsWindowWin32::WindowData(hWnd); and add it to the > > composite viewer. > > > > 2008/6/23 Robert Osfield <[EMAIL PROTECTED]>: > >> > >> Hi Alex, > >> > >> Does the new View share an existing graphics context, or does it have > >> a new graphics context? > >> > >> Robert. > >> > >> On Mon, Jun 23, 2008 at 11:05 AM, amalric alexandre > >> <[EMAIL PROTECTED]> wrote: > >> > The problem is that if I do not add those lines : > >> > > >> > osgViewer::CompositeViewer::Windows windows; > >> > m_rpCompoViewer->getWindows(windows); > >> > // clear out all the previously assigned operations > >> > for(osgViewer::CompositeViewer::Windows::iterator citr = > >> > windows.begin();citr != windows.end();++citr) > >> > { > >> > if(!((*citr)->isRealizedImplementation())) > >> > { > >> > > >> > (*citr)->realizeImplementation(); > >> > } > >> > } > >> > > >> > after calling addView (for the second view I add) it crashes in > >> > > >> > osg::getGLVersionNumber() > >> > > >> > at > >> > > >> > > >> > std::string vs( versionstring ); > >> > > >> > > >> > > >> > because versionstring is NULL > >> > > >> > Adding those lines seems to resolve the problem. > >> > Kind regards, > >> > 2008/6/23 Robert Osfield <[EMAIL PROTECTED]>: > >> >> > >> >> Hi Alex, > >> >> > >> >> What we might have to do is extended the addView method so it handles > >> >> situations like your more seemlessly, i.e. do the realize etc, > >> >> however, one has to be careful about this as often you'll add views > >> >> well before you actually want them to realize. Perhaps the best > thing > >> >> would to some kind of dirty mechanism that fires off a realize etc > on > >> >> the next frame. Just to be clear, it's the lack of realize on new > >> >> windows you've added that is the problem? > >> >> > >> >> Robert. > >> >> > >> >> > >> >> On Mon, Jun 23, 2008 at 10:48 AM, amalric alexandre > >> >> <[EMAIL PROTECTED]> wrote: > >> >> > > >> >> > Hi robert, > >> >> > > >> >> > My composite viewer is set as : > >> >> > > >> >> > m_rpCompoViewer = new osgViewer::CompositeViewer; > >> >> > > >> >> > > m_rpCompoViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded); > >> >> > > >> >> > I've found a osg message "[osg-users] Adding Views to a Running > >> >> > CompositeViewer" wich talks about the same problem as I have. > >> >> > > >> >> > I've juste added the code below after calling : > >> >> > m_rpCompoViewer->addView(rpView.get()); > >> >> > > >> >> > osgViewer::CompositeViewer::Windows windows; > >> >> > m_rpCompoViewer->getWindows(windows); > >> >> > // clear out all the previously assigned operations > >> >> > for(osgViewer::CompositeViewer::Windows::iterator citr = > >> >> > windows.begin();citr != windows.end();++citr) > >> >> > { > >> >> > if(!((*citr)->isRealizedImplementation())) > >> >> > { > >> >> > (*citr)->realizeImplementation(); > >> >> > } > >> >> > } > >> >> > > >> >> > and everything works fine. > >> >> > > >> >> > > >> >> > 2008/6/23 Robert Osfield <[EMAIL PROTECTED]>: > >> >> >> > >> >> >> HI Alex, > >> >> >> > >> >> >> I can't work out exactly what you mean w.r.t your setup. What > >> >> >> threading model is the viewer set up as? > >> >> >> > >> >> >> W.r.t SingleThreaded not setting the _threadsRunning flag... well, > >> >> >> if > >> >> >> it's single threaded then no extra threads will be running, so the > >> >> >> code is perfectly correct. > >> >> >> > >> >> >> Also if you report a crash, please make sure you provide a stack > >> >> >> trace > >> >> >> as this is essential for others to be able to help look for the > >> >> >> cause > >> >> >> of the problem. > >> >> >> > >> >> >> Robert. > >> >> >> > >> >> >> On Mon, Jun 23, 2008 at 10:30 AM, amalric alexandre > >> >> >> <[EMAIL PROTECTED]> wrote: > >> >> >> > Hi osg-users, > >> >> >> > > >> >> >> > I maybe found a bug on CompositeViewer::addView(osgViewer::View* > >> >> >> > view) > >> >> >> > in > >> >> >> > OSG 2.5.2. > >> >> >> > > >> >> >> > I have an application wich add and remove views on a > >> >> >> > compositeViewer > >> >> >> > embedded in MFC windows. When I try to add a new view it > crashes. > >> >> >> > > >> >> >> > With debug information I've noticed that in addView function > >> >> >> > _threadsRunning > >> >> >> > variable was always false, so that stopThreading is never > called. > >> >> >> > > >> >> >> > I've searched why _threadsRunning was false and I've found that > in > >> >> >> > ViewerBase::startThreading(), _threadsRunning is never set to > true > >> >> >> > because > >> >> >> > we return before at line 269 in case we're SingleThreaded, > >> >> >> > otherwise > >> >> >> > if > >> >> >> > we're CullDrawThreadPerContext for example we just break but we > >> >> >> > don't > >> >> >> > return. Is it normal ? > >> >> >> > > >> >> >> > Kind Regards, > >> >> >> > _______________________________________________ > >> >> >> > osg-users mailing list > >> >> >> > osg-users@lists.openscenegraph.org > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >> >> >> > > >> >> >> > > >> >> >> _______________________________________________ > >> >> >> osg-users mailing list > >> >> >> osg-users@lists.openscenegraph.org > >> >> >> > >> >> >> > >> >> >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >> >> > > >> >> > new osgViewer::CompositeViewer; > >> >> > _______________________________________________ > >> >> > osg-users mailing list > >> >> > osg-users@lists.openscenegraph.org > >> >> > > >> >> > > >> >> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >> >> > > >> >> > > >> >> _______________________________________________ > >> >> osg-users mailing list > >> >> osg-users@lists.openscenegraph.org > >> >> > >> >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >> > > >> > > >> > _______________________________________________ > >> > osg-users mailing list > >> > osg-users@lists.openscenegraph.org > >> > > >> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >> > > >> > > >> _______________________________________________ > >> osg-users mailing list > >> osg-users@lists.openscenegraph.org > >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > _______________________________________________ > > osg-users mailing list > > osg-users@lists.openscenegraph.org > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org