- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/cfg/VisualChooser.cpp
r12860 r13041 166 166 } 167 167 168 void VisualChooser::setVisualID( unsigned int id ) 169 { 170 _visual_id = id; 168 void VisualChooser::setVisualID( unsigned int id ) 169 { 170 _visual_id = id; 171 171 } 172 172 … … 180 180 } 181 181 182 void VisualChooser::clear() 182 void VisualChooser::clear() 183 183 { 184 184 _visual_attributes.clear(); … … 242 242 if((*_vinfo) && (aglDescribePixelFormat(*_vinfo, AGL_NO_RECOVERY, &val))) return _vinfo; 243 243 } 244 else 244 else 245 245 { 246 246 // Use malloc() since new() causes a bus error … … 285 285 { 286 286 std::cerr<< "aglChoosePixelFormat failed: " << aglGetError() << std::endl; 287 for(i=va.begin(); i!=va.end(); ++i) 287 for(i=va.begin(); i!=va.end(); ++i) 288 288 { 289 289 std::cerr << (*i) << ", "; … … 342 342 // If VisualInfo exists, then we may be able to reuse it 343 343 GLint val; 344 if(!CGLDescribePixelFormat(*_vinfo, 0L, kCGLPFANoRecovery, &val)) 344 if(!CGLDescribePixelFormat(*_vinfo, 0L, kCGLPFANoRecovery, &val)) 345 345 return _vinfo; 346 346 } … … 373 373 std::cerr<< "CGLChoosePixelFormat failed: " << CGLErrorString(err) << std::endl; 374 374 std::vector<int>::iterator i; 375 for(i=va.begin(); i!=va.end(); ++i) 375 for(i=va.begin(); i!=va.end(); ++i) 376 376 { 377 377 std::cerr << (*i) << ", "; … … 470 470 { 471 471 p = _visual_attributes.end() - 1; 472 472 473 473 while( _vinfo == NULL && va.size() > 0) 474 474 { … … 476 476 if( _vinfo == NULL && va.size() > 0 ) 477 477 { 478 478 479 479 // should we report an message that we're relaxing constraints here? 480 480 // std::cout << "Popping attributes"<<std::endl; … … 515 515 attribs.push_back(1); 516 516 attribs.push_back(WGL_ACCELERATION_ARB); 517 attribs.push_back(WGL_FULL_ACCELERATION_ARB); 517 attribs.push_back(WGL_FULL_ACCELERATION_ARB); 518 518 return; 519 519 } … … 536 536 switch (va.attribute()) 537 537 { 538 case Level: return; 539 case BufferSize: attr.first = WGL_COLOR_BITS_ARB; break; 538 case Level: return; 539 case BufferSize: attr.first = WGL_COLOR_BITS_ARB; break; 540 540 case RGBA: attr.first = WGL_PIXEL_TYPE_ARB; attr.second = WGL_TYPE_RGBA_ARB; break; 541 541 case Stereo: attr.first = WGL_STEREO_ARB; attr.second = 1; break; … … 570 570 setSimpleConfiguration(); 571 571 572 int vid; 572 int vid; 573 573 bool failed = false; 574 574 … … 587 587 if (failed) 588 588 { 589 // **** DRIVER BUG? It seems that some ATI cards don't support 589 // **** DRIVER BUG? It seems that some ATI cards don't support 590 590 // **** the WGL_SWAP_METHOD_ARB attribute. Now we try to remove 591 591 // **** it from the attribute list and choose a pixel format again. … … 593 593 { 594 594 if (*k == WGL_SWAP_METHOD_ARB) 595 { 595 { 596 596 // attribute come in sequential attribute,parameter pairs 597 597 // as WGL specifications so we need to delete two entries … … 656 656 { 657 657 // Is this additional check neccessary ? 658 // Did anyone encountered a situation where 658 // Did anyone encountered a situation where 659 659 // ChoosePixelFormat returned PXIELFORMAT worse than required ? 660 660 _visual_id = static_cast<unsigned int>(vid); … … 682 682 } 683 683 if ( !boolOK ) 684 vid = 0; 684 vid = 0; 685 685 } 686 686 687 687 if( vid == 0 ) 688 688 { … … 696 696 697 697 } while (failed); 698 698 699 699 } 700 700 … … 711 711 // than by descriptor. 712 712 _vinfo = new VisualInfo; 713 DescribePixelFormat(*dpy, _visual_id, sizeof(PIXELFORMATDESCRIPTOR), _vinfo); 713 DescribePixelFormat(*dpy, _visual_id, sizeof(PIXELFORMATDESCRIPTOR), _vinfo); 714 714 715 715 return _vinfo; … … 738 738 { 739 739 for (std::vector<VisualAttribute>::const_iterator i=_visual_attributes.begin(); i!=_visual_attributes.end(); ++i) 740 if (i->attribute() == DoubleBuffer) 740 if (i->attribute() == DoubleBuffer) 741 741 return true; 742 742
