Oh there is one more thing you need to first, you need create a new context
so that you can realize it,  otherwise  the function make current do not
take place

here is the final code

 

      viewer.setUpViewInWindow(x, y, width, height);

 

      //Get the traits of the current window

      osg::ref_ptr< osg::GraphicsContext::Traits > traits = new
osg::GraphicsContext::Traits(
*viewer.getCamera()->getGraphicsContext()->getTraits());

 

      // disable vertical sync

      traits->vsync = false;

 

      //Create a new graphics context with the modified traits

      osg::ref_ptr< osg::GraphicsContext > gc =
osg::GraphicsContext::createGraphicsContext( traits.get() );

      gc->realize();

      gc->makeCurrent();

 

      // set the vertical black off by default

      osgViewer::Viewer::Windows windows;

      viewer.getWindows(windows);

      for(osgViewer::Viewer::Windows::iterator itr = windows.begin(); itr !=
windows.end(); ++itr) {

            //(*itr)->setSyncToVBlank( !(*itr)->getSyncToVBlank() );

            (*itr)->setSyncToVBlank (false);

      }

 

 

you would think that a simple function on the viewer would do that kind of
thing without this kind of contorted code.

 

Julio

 

 

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to