#pragma comment(lib,"OpenThreadsd.lib")
#pragma comment(lib,"osgViewerd.lib")
#pragma comment(lib,"osgDBd.lib")
#pragma comment(lib,"osgd.lib")
#pragma comment(lib,"osgGAd.lib")
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osg/Node>
#include <osg/Material>
#include <osg/ShapeDrawable>
#include <osg/StateSet>
#include <osgGA/StateSetManipulator> //网格显示头文件
int main()
{
osg::ref_ptr<osgViewer::Viewer>viewer = new osgViewer::Viewer();
osg::ref_ptr<osg::Geode>geode = new osg::Geode();
osg::ref_ptr<osg::Sphere>sphere = new osg::Sphere(osg::Vec3(0,0,0),2.0);
osg::ref_ptr<osg::ShapeDrawable> shapeDrawable = new osg::ShapeDrawable(sphere);
geode->addDrawable(shapeDrawable);
osg::ref_ptr<osg::Material>material = new osg::Material();
material->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0,0,0
osg 网格显示球体
最新推荐文章于 2024-04-18 19:40:09 发布
该博客主要展示了如何使用osg库在C++中创建一个3D球体,并通过设置材质使其呈现红色。同时,它还演示了如何启用显示网格的功能,允许用户按'w'键在视图中以网格模式查看球体。
摘要由CSDN通过智能技术生成