感谢欢乐的小树,一切的编译和运行很顺利,来个转载

 环境

        采用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()); 


OSG could not find plugin to read objects解决方案

场景

        OSG加载文件出错

解决

        将build/bin/osgPlugins-3.6.5文件夹下的dll,拷贝到程序执行目录,解决问题