Okay, I found the problem : I just have to make and set a new graphic context on each new osgViewer::View Sorry for the inconvenience.
I just allow myself to a last question : Now, When I have two windows/View, the focus is given with a simple mouse fly over (without clicking). This can really become a problem... I don't think this is an OSG basic behavior, but I anyone have an idea about that... it can help me. Thanks for help, Regards, Vincent 2008/11/18 Vincent Bourdier <[EMAIL PROTECTED]> > Hi Robert, > > What I don't understand is why I get this error one time and not the > previous... the code is exactly the same. > > int addWindow(bool buildscene) >> { >> osg::ref_ptr<osgViewer::View> view = new osgViewer::View; >> >> compViewer->addView( view.get() ); >> view->setUpViewInWindow( 10, 200, 440, 380 ); >> if(buildscene){ //true the first time only >> _root = new osg::Group; >> buildScene(); >> } >> view->setSceneData( _root.get()); >> view->setCameraManipulator( new osgGA::TrackballManipulator ); >> } >> > > In the main() : before launching the loop > > // construct the viewer. >> compViewer = new osgViewer::CompositeViewer; >> >> compViewer->setThreadingModel(osgViewer::Viewer::DrawThreadPerContext); >> >> addWindow(true); //create the first one with building the scene >> addWindow(true); //add a view : this call do not make problems >> > > In the loop : > > while (!compViewer->done() && !masterKilled) { >> if (!masterKilled) { >> compViewer->frame(); >> test++; >> if(test == 200){ >> addWindow(false); //this call crash with OpenGl >> } >> >> } >> > > I'm lost... with the context can have changed ? How to verify it ? create > it ? > > thanks. > > Regards, > Vincent. > > > 2008/11/18 Robert Osfield <[EMAIL PROTECTED]> > > Hi Vincent, >> >> You make no mention of where you call osg::getGLVersionNumber(), but >> given you're getting a crash I'd guess you are calling it from a >> thread that doesn't have a graphics context current. All OpenGL calls >> have to be called from a thread with a valid graphics context. There >> has been plenty discussed about this on osg-uses over the years so >> check out the archives on the topic. >> >> Robert. >> >> On Tue, Nov 18, 2008 at 1:20 PM, Vincent Bourdier >> <[EMAIL PROTECTED]> wrote: >> > Hi all, >> > >> > Using composite viewer, I have a strange behavior : >> > >> > If, during the build of my scene, I make 1, 2... osgViewer::view in the >> same >> > composite viewer, everything is godd and work well. >> > >> > But, if during the render loop (after 200 frame() ) I had one View, with >> the >> > same code of the previous, I have a crash in getGLVersionNumber : >> > (glextensions.cpp) >> > >> > float osg::getGLVersionNumber() >> > { >> > // needs to be extended to do proper things with subversions like >> 1.5.1, >> > etc. >> > char *versionstring = (char*) glGetString( GL_VERSION ); //HERE >> > void char* on the last View, but not on the previous one(s)... >> > std::string vs( versionstring ); >> > return( atof( vs.substr( 0, vs.find( " " ) ).c_str() ) ); >> > } >> > >> > >> > >> > I does not make any sense for me... the GL_VERSION is defined, so what >> > happens ? >> > >> > Any Idea ? >> > >> > Thanks. >> > >> > Regards, >> > Vincent. >> > >> > >> > >> > >> > _______________________________________________ >> > 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