OSG第一課學習

感謝歡樂的小樹,一切的編譯和運行很順利,來個轉載https://blog.csdn.net/wangbingqian_110/article/details/78069061

 環境

        採用CMake版本3.10.0-rc1,需要加載JPEG和PNG圖片文件,因此ACTUAL_3RDPARY_DIR需要指定第三方庫的正確目錄,否則調用osgDB::readImageFile函數返回空指針。

目標

        場景元素貼圖視頻畫面進行展示


簡單渲染一個圓球

#include <osg/ShapeDrawable>

 //創建一個圓球
 osg::ref_ptr<osg::Sphere> sphere = new osg::Sphere;
 sphere->set(osg::Vec3(0.0, 0.0, 50.0), 30);
 osg::ref_ptr<osg::ShapeDrawable> sd = new osg::ShapeDrawable(sphere.get());


 osg::ref_ptr<osg::Geode> geode = new osg::Geode;
 geode->addDrawable(sd.get()); 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章