Added password support into osgvnc example and vnc plugin

This commit is contained in:
Robert Osfield
2011-10-26 12:29:38 +00:00
parent b9d7989b44
commit 9995cb70a9
2 changed files with 58 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
#include <osgWidget/VncClient>
#include <osgDB/Registry>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
@@ -46,10 +47,23 @@ int main(int argc,char** argv)
osg::ref_ptr<osg::Group> group = new osg::Group;
std::string password;
while(arguments.read("--password",password))
{
}
for(int i=1; i<arguments.argc(); ++i)
{
if (!arguments.isOption(i))
{
std::string hostname = arguments[i];
if (!password.empty())
{
if (!osgDB::Registry::instance()->getAuthenticationMap()) osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap);
osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(hostname, new osgDB::AuthenticationDetails("", password));
}
osg::ref_ptr<osgWidget::VncClient> vncClient = new osgWidget::VncClient;
if (vncClient->connect(arguments[i], hints))
{