| | 732 | class TestSupportCallback : public osgProducer::OsgCameraGroup::RealizeCallback |
| | 733 | { |
| | 734 | public: |
| | 735 | TestSupportCallback():_supported(true),_errorMessage() {} |
| | 736 | |
| | 737 | virtual void operator()( osgProducer::OsgCameraGroup&, osgProducer::OsgSceneHandler& sh, const Producer::RenderSurface& ) |
| | 738 | { |
| | 739 | unsigned int contextID = sh.getSceneView()->getState()->getContextID(); |
| | 740 | osg::GL2Extensions* gl2ext = osg::GL2Extensions::Get(contextID,true); |
| | 741 | if( gl2ext ) |
| | 742 | { |
| | 743 | if( !gl2ext->isGlslSupported() ) |
| | 744 | { |
| | 745 | _supported = false; |
| | 746 | _errorMessage = "ERROR: GLSL not supported by OpenGL driver."; |
| | 747 | } |
| | 748 | |
| | 749 | GLint numVertexTexUnits = 0; |
| | 750 | glGetIntegerv( GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &numVertexTexUnits ); |
| | 751 | if( numVertexTexUnits <= 0 ) |
| | 752 | { |
| | 753 | _supported = false; |
| | 754 | _errorMessage = "ERROR: vertex texturing not supported by OpenGL driver."; |
| | 755 | } |
| | 756 | } |
| | 757 | |
| | 758 | } |
| | 759 | |
| | 760 | bool _supported; |
| | 761 | std::string _errorMessage; |
| | 762 | |
| | 763 | }; |
| | 764 | |
| 782 | | |
| 783 | | // not all hardware can support vertex texturing, so check first. |
| 784 | | for(unsigned int contextID = 0; |
| 785 | | contextID<viewer.getDisplaySettings()->getMaxNumberOfGraphicsContexts(); |
| 786 | | ++contextID) |
| 787 | | { |
| 788 | | osg::GL2Extensions* gl2ext = osg::GL2Extensions::Get(contextID,false); |
| 789 | | if( gl2ext ) |
| 790 | | { |
| 791 | | if( !gl2ext->isGlslSupported() ) |
| 792 | | { |
| 793 | | std::cout<<"ERROR: GLSL not supported by OpenGL driver."<<std::endl; |
| 794 | | return 1; |
| 795 | | } |
| 796 | | |
| 797 | | GLint numVertexTexUnits = 0; |
| 798 | | glGetIntegerv( GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &numVertexTexUnits ); |
| 799 | | if( numVertexTexUnits <= 0 ) |
| 800 | | { |
| 801 | | std::cout<<"ERROR: vertex texturing not supported by OpenGL driver."<<std::endl; |
| 802 | | return 1; |
| 803 | | } |
| 804 | | } |
| | 818 | |
| | 819 | if (!testSupportCallback->_supported) |
| | 820 | { |
| | 821 | osg::notify(osg::WARN)<<testSupportCallback->_errorMessage<<std::endl; |
| | 822 | exit(1); |