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

猜你喜欢

转载自blog.51cto.com/fengyuzaitu/2619525