| 247 | | public: |
| 248 | | TestSupportCallback():_supported(true),_errorMessage() {} |
| | 246 | public: |
| | 247 | |
| | 248 | TestSupportOperation(): |
| | 249 | osg::GraphicsOperation("TestSupportOperation",false), |
| | 250 | _supported(true), |
| | 251 | _errorMessage() {} |
| | 252 | |
| | 253 | virtual void operator () (osg::GraphicsContext* gc) |
| | 254 | { |
| | 255 | osg::notify(osg::NOTICE)<<"Not called"<<std::endl; |
| | 256 | |
| | 257 | OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex); |
| | 258 | |
| | 259 | unsigned int contextID = gc->getState()->getContextID(); |
| | 260 | osg::GL2Extensions* gl2ext = osg::GL2Extensions::Get(contextID,true); |
| | 261 | if( gl2ext ) |
| | 262 | { |
| | 263 | if( !gl2ext->isGlslSupported() ) |
| | 264 | { |
| | 265 | _supported = false; |
| | 266 | _errorMessage = "ERROR: GLSL not supported by OpenGL driver."; |
| | 267 | } |
| | 268 | |
| | 269 | GLint numVertexTexUnits = 0; |
| | 270 | glGetIntegerv( GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &numVertexTexUnits ); |
| | 271 | if( numVertexTexUnits <= 0 ) |
| | 272 | { |
| | 273 | _supported = false; |
| | 274 | _errorMessage = "ERROR: vertex texturing not supported by OpenGL driver."; |
| | 275 | } |
| | 276 | } |
| | 277 | |
| | 278 | _supported = false; |
| | 279 | _errorMessage = "ERROR: Pllalalal."; |
| | 280 | |
| | 281 | } |
| 250 | | virtual void operator()( osgProducer::OsgCameraGroup&, osgProducer::OsgSceneHandler& sh, const Producer::RenderSurface& ) |
| 251 | | { |
| 252 | | { |
| 253 | | OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex); |
| 254 | | |
| 255 | | unsigned int contextID = sh.getSceneView()->getState()->getContextID(); |
| 256 | | osg::GL2Extensions* gl2ext = osg::GL2Extensions::Get(contextID,true); |
| 257 | | if( gl2ext ) |
| 258 | | { |
| 259 | | if( !gl2ext->isGlslSupported() ) |
| 260 | | { |
| 261 | | _supported = false; |
| 262 | | _errorMessage = "ERROR: GLSL not supported by OpenGL driver."; |
| 263 | | } |
| 264 | | |
| 265 | | GLint numVertexTexUnits = 0; |
| 266 | | glGetIntegerv( GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &numVertexTexUnits ); |
| 267 | | if( numVertexTexUnits <= 0 ) |
| 268 | | { |
| 269 | | _supported = false; |
| 270 | | _errorMessage = "ERROR: vertex texturing not supported by OpenGL driver."; |
| 271 | | } |
| 272 | | } |
| 273 | | } |
| 274 | | |
| 275 | | sh.init(); |
| 276 | | } |
| 277 | | |
| 278 | | OpenThreads::Mutex _mutex; |
| 279 | | bool _supported; |
| 280 | | std::string _errorMessage; |
| 281 | | |
| | 283 | OpenThreads::Mutex _mutex; |
| | 284 | bool _supported; |
| | 285 | std::string _errorMessage; |
| 295 | | #if 0 |
| 296 | | // register a test extension callback to be called when app realizes and gets a valid graphics context |
| 297 | | osg::ref_ptr<TestSupportCallback> testSupportCallback = new TestSupportCallback(); |
| 298 | | viewer.setRealizeCallback(testSupportCallback.get()); |
| | 298 | viewer.setUpViewAcrossAllScreens(); |
| | 299 | |
| | 300 | osg::ref_ptr<TestSupportOperation> testSupportOperation = new TestSupportOperation; |
| | 301 | |
| | 302 | osgViewer::Viewer::Windows windows; |
| | 303 | viewer.getWindows(windows); |
| | 304 | for(osgViewer::Viewer::Windows::iterator itr = windows.begin(); |
| | 305 | itr != windows.end(); |
| | 306 | ++itr) |
| | 307 | { |
| | 308 | (*itr)->add(testSupportOperation.get()); |
| | 309 | } |
| | 310 | |