您的位置:首页 > 其它

开始学习OSG

2013-11-15 16:52 260 查看
#ifdef _DEBUG
#pragma comment(lib,"osgViewerd.lib")
#pragma comment(lib,"osgDBd.lib")
#pragma comment(lib,"OpenThreadsd.lib")
#pragma comment(lib,"osgd.lib")
#else
#pragma comment(lib,"osgViewer.lib")
#pragma comment(lib,"osgDB.lib")
#pragma comment(lib,"OpenThreads.lib")
#pragma comment(lib,"osgUtil.lib")
#pragma comment(lib,"osg.lib")
#endif

#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osg/MatrixTransform>
#include <osg/Node>

int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
osg::ref_ptr<osg::Group> gp= new osg::Group;
osg::ref_ptr<osg::Node> cowNode = osgDB::readNodeFile("cow.osg");
gp->addChild(cowNode);
osg::ref_ptr<osg::MatrixTransform > yaw= new osg::MatrixTransform;
yaw->setMatrix(osg::Matrix::rotate(osg::DegreesToRadians(-45.0),0,1,0)*osg::Matrix::translate(0,0,3));
yaw->addChild(cowNode);
gp->addChild(yaw);
viewer->setSceneData(gp);
return viewer->run();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: