Show
Ignore:
Timestamp:
11/24/14 16:24:31 (10 hours ago)
Author:
robert
Message:

From Jan Klimke, "i noticed, that there are a couple of additional flaws when building osg for Mac OS X 10.10 Yosemite.

The mac os sdk version is recognized by the current CMAKE script as 10.1 instead of 10.10 since it cuts the version string from the 4th place. I introduced a more reliable version checking based on splitting the returned version code into MAJOR MINOR and PATCH parts and reassemble the OSG sdk version afterwards.

I replaced the existing CMake code against the following (returning now version 10.10 as expected):

# Determine the canonical name of the selected Platform SDK

EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"

OUTPUT_VARIABLE OSG_OSX_SDK_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)

STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME})
LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR)
LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR)
LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH)

SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}")

Also i added the check for the new Version to some more find scripts.

Additionally the nil object in Objective C now seems to be equivalent with a null_ptr that cannot be passed as GLInt anymore. So i switched this in the PixelBufferCocoa?.mm to pass a zero instead of nil.
"

Files:
1 modified

Legend:

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

    r12529 r14195  
    4545 
    4646    CreateModelToSaveVisitor(): 
    47         osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)         
     47        osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) 
    4848    { 
    4949        _group = new osg::Group; 
    5050        _addToModel = false; 
    5151    } 
    52      
     52 
    5353    virtual void apply(osg::Node& node) 
    5454    { 
     
    6666        } 
    6767    } 
    68      
     68 
    6969    osg::ref_ptr<osg::Group> _group; 
    7070    bool _addToModel; 
     
    7676 
    7777    DeleteSelectedNodesVisitor(): 
    78         osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)         
    79     { 
    80     } 
    81      
     78        osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) 
     79    { 
     80    } 
     81 
    8282    virtual void apply(osg::Node& node) 
    8383    { 
     
    9292        } 
    9393    } 
    94      
     94 
    9595    void pruneSelectedNodes() 
    9696    { 
     
    105105                ++pitr) 
    106106            { 
    107                 osg::Group* parent = *pitr; 
     107                osg::Node* parent = *pitr; 
    108108                parent->removeChild(node); 
    109109            } 
    110110        } 
    111111    } 
    112      
     112 
    113113    typedef std::vector< osg::ref_ptr<osgFX::Scribe> > SelectedNodes; 
    114114    SelectedNodes _selectedNodes; 
    115      
     115 
    116116}; 
    117117 
    118118// class to handle events with a pick 
    119 class PickHandler : public osgGA::GUIEventHandler  
     119class PickHandler : public osgGA::GUIEventHandler 
    120120{ 
    121 public:  
     121public: 
    122122 
    123123    PickHandler(): 
     
    140140                { 
    141141                    saveSelectedModel(viewer->getSceneData()); 
    142                 }                 
     142                } 
    143143                else if (ea.getKey()=='o') 
    144144                { 
     
    190190                } 
    191191                return true; 
    192             }     
     192            } 
    193193 
    194194            default: 
     
    249249                parent = (nodePath.size()>=2)?dynamic_cast<osg::Group*>(nodePath[nodePath.size()-2]):0; 
    250250 
    251                 if (node) std::cout<<"  Hits "<<node->className()<<" nodePath size "<<nodePath.size()<<std::endl;     
     251                if (node) std::cout<<"  Hits "<<node->className()<<" nodePath size "<<nodePath.size()<<std::endl; 
    252252                toggleScribe(parent, node); 
    253253            } 
     
    285285                toggleScribe(parent, node); 
    286286            } 
    287         }         
     287        } 
    288288 
    289289        // now we try to decorate the hit node by the osgFX::Scribe to show that its been "picked" 
     
    320320    { 
    321321        if (!scene) return; 
    322      
     322 
    323323        CreateModelToSaveVisitor cmtsv; 
    324324        scene->accept(cmtsv); 
    325          
     325 
    326326        if (cmtsv._group->getNumChildren()>0) 
    327327        { 
     
    341341{ 
    342342    osg::ref_ptr<osg::Node> loadedModel; 
    343      
     343 
    344344    // load the scene. 
    345345    if (argc>1) loadedModel = osgDB::readNodeFile(argv[1]); 
    346      
     346 
    347347    // if not loaded assume no arguments passed in, try use default mode instead. 
    348348    if (!loadedModel) loadedModel = osgDB::readNodeFile("dumptruck.osgt"); 
    349      
    350     if (!loadedModel)  
     349 
     350    if (!loadedModel) 
    351351    { 
    352352        std::cout << argv[0] <<": No data loaded." << std::endl; 
    353353        return 1; 
    354354    } 
    355      
     355 
    356356    // create the window to draw to. 
    357357    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; 
     
    377377    viewer.getCamera()->setViewport(0,0,800,600); 
    378378    viewer.setSceneData(loadedModel.get()); 
    379      
     379 
    380380    // create a tracball manipulator to move the camera around in response to keyboard/mouse events 
    381381    viewer.setCameraManipulator( new osgGA::TrackballManipulator );