Show
Ignore:
Timestamp:
10/26/11 14:29:38 (6 years ago)
Author:
robert
Message:

Added password support into osgvnc example and vnc plugin

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgvnc/osgvnc.cpp

    r12292 r12851  
    11#include <osgWidget/VncClient> 
    22 
     3#include <osgDB/Registry> 
    34#include <osgViewer/Viewer> 
    45#include <osgViewer/ViewerEventHandlers> 
     
    4748    osg::ref_ptr<osg::Group> group = new osg::Group; 
    4849 
     50    std::string password; 
     51    while(arguments.read("--password",password)) 
     52    { 
     53    } 
     54 
    4955    for(int i=1; i<arguments.argc(); ++i) 
    5056    { 
    5157        if (!arguments.isOption(i)) 
    5258        { 
     59            std::string hostname = arguments[i]; 
     60 
     61            if (!password.empty()) 
     62            { 
     63                if (!osgDB::Registry::instance()->getAuthenticationMap()) osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap); 
     64                osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(hostname, new osgDB::AuthenticationDetails("", password)); 
     65            } 
     66 
    5367            osg::ref_ptr<osgWidget::VncClient> vncClient = new osgWidget::VncClient; 
    5468            if (vncClient->connect(arguments[i], hints))