Changeset 12851
- Timestamp:
- 10/26/11 14:29:38 (20 months ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 2 modified
-
examples/osgvnc/osgvnc.cpp (modified) (2 diffs)
-
src/osgPlugins/vnc/ReaderWriterVNC.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgvnc/osgvnc.cpp
r12292 r12851 1 1 #include <osgWidget/VncClient> 2 2 3 #include <osgDB/Registry> 3 4 #include <osgViewer/Viewer> 4 5 #include <osgViewer/ViewerEventHandlers> … … 47 48 osg::ref_ptr<osg::Group> group = new osg::Group; 48 49 50 std::string password; 51 while(arguments.read("--password",password)) 52 { 53 } 54 49 55 for(int i=1; i<arguments.argc(); ++i) 50 56 { 51 57 if (!arguments.isOption(i)) 52 58 { 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 53 67 osg::ref_ptr<osgWidget::VncClient> vncClient = new osgWidget::VncClient; 54 68 if (vncClient->connect(arguments[i], hints)) -
OpenSceneGraph/trunk/src/osgPlugins/vnc/ReaderWriterVNC.cpp
r12850 r12851 50 50 static void updateImage(rfbClient* client,int x,int y,int w,int h); 51 51 52 static void passwordCheck(rfbClient* client,const char* encryptedPassWord,int len); 53 static char* getPassword(rfbClient* client); 54 55 std::string _username; 56 std::string _password; 52 57 double _timeOfLastUpdate; 53 58 double _timeOfLastRender; … … 138 143 139 144 _inactiveBlock = new osg::RefBlock; 140 141 145 } 142 146 … … 198 202 } 199 203 204 void LibVncImage::passwordCheck(rfbClient* client,const char* encryptedPassWord,int len) 205 { 206 OSG_NOTICE<<"LibVncImage::passwordCheck"<<std::endl; 207 } 208 209 char* LibVncImage::getPassword(rfbClient* client) 210 { 211 LibVncImage* image = (LibVncImage*)(rfbClientGetClientData(client, 0)); 212 OSG_NOTICE<<"LibVncImage::getPassword "<<image->_password<<std::endl; 213 return strdup(image->_password.c_str()); 214 } 215 200 216 201 217 bool LibVncImage::connect(const std::string& hostname) … … 212 228 _client->HandleTextChat = 0; 213 229 230 // provide the password if we have one assigned 231 if (!_password.empty()) _client->GetPassword = getPassword; 232 214 233 rfbClientSetClientData(_client, 0, this); 215 234 … … 268 287 PrintPixelFormat(&(client->format)); 269 288 289 #ifdef __APPLE__ 290 // feedback is that Mac's have an endian swap even though the PixelFormat results see under OSX are identical. 291 bool swap = true; 292 #else 270 293 bool swap = client->format.redShift!=0; 294 #endif 295 271 296 GLenum gl_pixelFormat = swap ? GL_BGRA : GL_RGBA; 272 297 … … 349 374 350 375 osg::ref_ptr<LibVncImage> image = new LibVncImage; 351 image->setDataVariance(osg::Object::DYNAMIC); 352 376 image->setDataVariance(osg::Object::DYNAMIC); 353 377 image->setOrigin(osg::Image::TOP_LEFT); 378 379 const osgDB::AuthenticationMap* authenticationMap = (options && options->getAuthenticationMap()) ? 380 options->getAuthenticationMap() : 381 osgDB::Registry::instance()->getAuthenticationMap(); 382 383 const osgDB::AuthenticationDetails* details = authenticationMap ? 384 authenticationMap->getAuthenticationDetails(hostname) : 385 0; 386 387 // configure authentication if required. 388 if (details) 389 { 390 OSG_NOTICE<<"Passing in password = "<<details->password<<std::endl; 391 392 image->_username = details->username; 393 image->_password = details->password; 394 } 354 395 355 396 if (!image->connect(hostname))
