Show
Ignore:
Timestamp:
03/09/11 11:35:00 (4 years ago)
Author:
robert
Message:

Changed the use of a viewer thread to be off by default because it was causing the application to crash when any users input was recieved

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgQtWidgets/osgQtWidgets.cpp

    r11979 r12212  
    138138    // true = run osgViewer in a separate thread than Qt 
    139139    // false = interleave osgViewer and Qt in the main thread 
    140     bool useFrameLoopThread = true; 
    141     if (arguments.read("--noFrameThread")) useFrameLoopThread = false; 
     140    bool useFrameLoopThread = false; 
     141    if (arguments.read("--no-frame-thread")) useFrameLoopThread = false; 
     142    if (arguments.read("--frame-thread")) useFrameLoopThread = true; 
    142143 
    143144    // true = use QWidgetImage 
     
    377378 
    378379            osg::MatrixTransform* mt = new osg::MatrixTransform; 
     380 
     381            osg::Texture2D* texture = new osg::Texture2D(widgetImage.get()); 
     382            texture->setResizeNonPowerOfTwoHint(false); 
     383            texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); 
     384            texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); 
     385            texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); 
     386            mt->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); 
     387 
     388            osgViewer::InteractiveImageHandler* handler;  
    379389            if (inScene) 
    380390            { 
    381391                mt->setMatrix(osg::Matrix::rotate(osg::Vec3(0,1,0), osg::Vec3(0,0,1))); 
    382392                mt->addChild(geode); 
     393 
     394                handler = new osgViewer::InteractiveImageHandler(widgetImage.get()); 
    383395            } 
    384396            else    // fullscreen 
     
    402414 
    403415                mt->addChild(camera); 
     416 
     417                handler = new osgViewer::InteractiveImageHandler(widgetImage.get(), texture, camera); 
    404418            } 
    405419 
     
    409423            mt->getOrCreateStateSet()->setAttribute(new osg::Program); 
    410424 
    411             osg::Texture2D* texture = new osg::Texture2D(widgetImage.get()); 
    412             texture->setResizeNonPowerOfTwoHint(false); 
    413             texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); 
    414             texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); 
    415             texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); 
    416             mt->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); 
    417  
    418425            osg::Group* overlay = new osg::Group; 
    419426            overlay->addChild(mt); 
    420427 
    421428            root->addChild(overlay); 
    422  
    423             osgViewer::InteractiveImageHandler* handler = new osgViewer::InteractiveImageHandler(widgetImage.get(), texture, camera); 
     429             
    424430            quad->setEventCallback(handler); 
    425431            quad->setCullCallback(handler);