资源简介
main.cpp
代码片段和文件信息
#include “../Common/Common.h“
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifdef _DEBUG
#pragma comment(lib “../Debug/Commond.lib“)
#else
#pragma comment(lib “../Release/Common.lib“)
#endif
osg::ref_ptr CreateBox()
{
osg::ref_ptr geode = new osg::Geode;
osg::ref_ptr hints = new osg::TessellationHints;
osg::ref_ptr shape = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0 0.0 0.0) 1.0 10.0 10.0) hints.get());
osg::ref_ptr material = new osg::Material;
osg::ref_ptr texture2D = new osg::Texture2D;
osg::ref_ptr image;
//设置颜色
shape->setColor(osg::Vec4(0.5 0.5 0.5 0.1));
//设置精度
hints->setDetailRatio(0.5);
//设置材质
material->setAmbient(osg::Material::FRONT_AND_BACK osg::Vec4f(1.0 1.0 1.0 0.5));
material->setDiffuse(osg::Material::FRONT_AND_BACK osg::Vec4f(1.0 1.0 1.0 0.5));
material->setSpecular(osg::Material::FRONT_AND_BACK osg::Vec4f(1.0 1.0 1.0 0.5));
material->setShininess(osg::Material::FRONT_AND_BACK 6.0);
//设置纹理
image = osgDB::readImageFile(“Images/whitemetal_diffuse.jpg“);
if(image.valid())
{
texture2D->setImage(image.get());
}
//set state
geode->getOrCreateStateSet()->setAttributeAndModes(material.get() osg::StateAttribute::ON);
geode->getOrCreateStateSet()->setMode(GL_BLEND osg::StateAttribute::ON);
geode->getOrCreateStateSet()->setMode(GL_DEPTH_TEST osg::StateAttribute::ON);
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0 texture2D.get() osg::StateAttribute::ON);
geode->addDrawable(shape.get());
return - 上一篇:MFC读写CSV文件
- 下一篇:C++ Builder利用PDFLib生成PDF文档
相关资源
- 《Linux程序设计》第四版pdf高清电子版
- C++ Primer mobi
- 使用 IBM Rational Systems Developer 和 Rati
- VC编程助手2010破解版(原名VA_X_10.6.
- Linux操作系统下C语言编程从零开始
- 一个C++实现的源代码行数统计工具
- easySize使用方法和代码
- TLV解析算法
- C++ 从入门到精通明日科技光盘 百度云
- C和C++.rar
- consts.cpp
- 银行管理系统.cpp
- VC++外挂框架.rar
- VisualC++网络高级编程.(人民邮电.陈坚
- C++黑客编程揭秘与防范.pdf
- BombGoldFlower.cpp
- c++万能外挂.txt
- ZhajingHua.cpp
- C++AMP.pdf
- c++程序设计语言英文第三版.pdf
- Visual_assist_X_for_VC6.0破解版.rar
- 《C语言程序设计》谭浩强.pdf
- c++辅助源码.rar
- GBT28169-2011嵌入式软件C语言编码规范
- 用MFC实现的图像处理源代码总集
- C语言程序设计(郑莉)源码.rar
- zw_MFC编写一个简单的登录对话框(连
- 鸡啄米:VS2010MFC编程入门教程.pdf
- ATM源代码用c++文件读写.zip
- C语言写的文件传输系统
川公网安备 51152502000135号
评论
共有 条评论