#ifdef _WIN32
#include <Windows.h>
#endif // _WIN32 #include <osg/Group>
#include <osg/Camera>
#include <osgDB/ReadFile>
#include <osg/Node> #include <osg/Geometry>
#include <osg/Image>
#include <osg/ShapeDrawable>
#include <osg/Texture2D> #include <osg/MatrixTransform>
#include <osg/AnimationPath> #include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers> #include <osgGA/DriveManipulator>
#include <osgGA/GUIEventHandler>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIActionAdapter> #include <osgGA/AnimationPathManipulator>
#include <osgGA/KeySwitchMatrixManipulator> #include <osgUtil/LineSegmentIntersector> #include <iostream>
using namespace std; //顶点着色器
static const char* vertShader = {
"varying vec4 color;\n"
"void main(void)\n"
"{\n"
"color = gl_Vertex;\n"
"gl_Position=gl_ModelViewProjectionMatrix*gl_Vertex;\n"
"}\n"
}; //片元着色器
static const char* fragShader = {
"varying vec4 color;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = clamp(color,0.1,0.8);\n"
"}\n"
}; int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer;
osg::ref_ptr<osg::Group> group1 = new osg::Group;
osg::ref_ptr<osg::Program> program1 = new osg::Program;
//osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:\\参考手册\\BIM\\osg\\四合院2019.osgb");
osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:\\参考手册\\BIM\\obj\\person1.obj"); osg::ref_ptr<osg::StateSet> stateset1 = node1->getOrCreateStateSet(); program1->addShader(new osg::Shader(osg::Shader::VERTEX, vertShader));
program1->addShader(new osg::Shader(osg::Shader::FRAGMENT, fragShader));
stateset1->setAttributeAndModes(program1, osg::StateAttribute::ON); group1->addChild(node1.get());
viewer1->setSceneData(group1);
viewer1->setUpViewInWindow(, , , , ); return viewer1->run();
}

最新文章

  1. Spring in Action 学习笔记二-DI
  2. 【教程】CDQ套CDQ——四维偏序问题
  3. Scrum Meeting 12-20151218
  4. ASIHTTPRequest实现https双向认证请求
  5. USB枚举过程(2)
  6. SPI的工作模式口诀[转]
  7. 黑马程序员_JavaIO流(四)
  8. 解决方案:elipse一直loading descriptor for...
  9. JavaScript实现360度全景图片展示效果
  10. MySql 如何实现不同数据库同步【2个】
  11. JBDC工具类
  12. Java多线程(四)—— synchronized关键字续
  13. LeetCode--326--3的幂
  14. Windows 64位系统安装Apache2.4
  15. element-ui inputNumber、Card 、Breadcrumb组件源码分析整理笔记(三)
  16. windows10下使用source insight出现&quot;source insight program editor已停止工作&quot;的问题
  17. Codeforces777D Cloud of Hashtags 2017-05-04 18:06 67人阅读 评论(0) 收藏
  18. POJ 2242
  19. Oracle EBS 报错:此责任无可用函数。 更改责任或与您的系统管理员联系。
  20. [ActionScript 3.0] 通过as3操作web内容

热门文章

  1. Vue 前后端分离系统中遇到跨域问题
  2. m_strcmp
  3. python-Redis cluster基础指标监控
  4. plsql工具使用
  5. 专为简化 C 开发而设计的编程语言 Trad
  6. vuex 全局store,前后端交互
  7. 如何让MySQL语句执行加速?
  8. [AngularJS] Extend Controller
  9. &amp;和&amp;&amp;,|和||的用法区别
  10. 使用webuploader实现大文件上传分片上传