参考帖子:

https://blog.csdn.net/csxiaoshui/article/details/23457273

osg::Geometry *lineStripGeometry = new osg::Geometry;
osg::Vec3Array *lineVertexArray = new osg::Vec3Array;
double dRadius = 0.1;
for (float angle = 0.0; angle < 400.0; angle += 0.1)
{
lineVertexArray->push_back(osg::Vec3(dRadius * cos(angle), dRadius * sin(angle), ));
dRadius *= 1.002;
}
osg::Vec4Array *lineColorArray = new osg::Vec4Array;
lineColorArray->push_back(osg::Vec4(1.0, 1.0, 1.0, 1.0));
lineStripGeometry->setVertexArray(lineVertexArray);
lineStripGeometry->setColorArray(lineColorArray);
//OSG 3.2之后的版本在setColorArray中设置绑定方式
lineStripGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
lineStripGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, , lineVertexArray->size()));
lineStripGeometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); //添加模板测试
osg::Stencil *lineStripStencil = new osg::Stencil;
lineStripStencil->setFunction(osg::Stencil::NEVER, 0x0, 0x0);
lineStripStencil->setOperation(osg::Stencil::INCR, osg::Stencil::INCR, osg::Stencil::INCR);
lineStripGeometry->getOrCreateStateSet()->setAttributeAndModes(lineStripStencil);
////////////////////////////////////////////////////////////////////////// osg::Geometry *quadGeometry = new osg::Geometry; osg::Vec3Array *quadVertexArray = new osg::Vec3Array;
quadVertexArray->push_back(osg::Vec3(, , ));
quadVertexArray->push_back(osg::Vec3(, , ));
quadVertexArray->push_back(osg::Vec3(, , ));
quadVertexArray->push_back(osg::Vec3(, , )); osg::Vec4Array *quadColorArray = new osg::Vec4Array;
quadColorArray->push_back(osg::Vec4(0.0, 1.0, 1.0, 1.0)); quadGeometry->setVertexArray(quadVertexArray);
quadGeometry->setColorArray(quadColorArray);
quadGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
quadGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, , ));
quadGeometry->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); osg::Stencil *quadStencil = new osg::Stencil;
quadStencil->setFunction(osg::Stencil::NOTEQUAL, 0x1, 0x1);
quadStencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::KEEP);
quadGeometry->getOrCreateStateSet()->setAttributeAndModes(quadStencil); osg::Geode *geode = new osg::Geode;
geode->addDrawable(lineStripGeometry);
geode->addDrawable(quadGeometry);
---------------------
作者:csxiaoshui
来源:CSDN
原文:https://blog.csdn.net/csxiaoshui/article/details/23457273
版权声明:本文为博主原创文章,转载请附上博文链接!

OSG使用模板缓存的更多相关文章

  1. AngularJs $templateCache 和 $templateRequest 模板缓存

    $templateCache 第一次使用模板,它被加载到模板缓存中,以便快速检索.你可以直接将模板标签加载到缓存中,或者通过$templateCache服务. 通过script标签: <scri ...

  2. [ZZ] D3D中的模板缓存(3)

    http://www.cppblog.com/lovedday/archive/2008/03/25/45334.html http://www.cppblog.com/lovedday/ D3D中的 ...

  3. D3D 模板缓存的创建过程

    下面是我对模板缓存创建的理解: 1. 模板缓存是和深度缓存一起被创建的,将深度缓存的一部分作为模板缓存使用. 深度缓存和模板缓存是在Direct3D初始化时创建的,D3DPRESENT_PARAMET ...

  4. Jquery 模板插件 jquery.tmpl.js 的使用方法(2):嵌套each循环,temp调用(使用预编译的模板缓存)

    直接上代码吧 一:主窗口 /*#region SendChooseTargetTemplate 发送候选人主窗口模板*/ var SendChooseTargetTemplate = ''; Send ...

  5. AngularJS ngTemplate寄宿方式 模板缓存 $templateCache

    AngularJS的指令中经常定义模板(template或templateUrl),可以选择将Html模板直接寄宿在WEB容器中,如Tomcat.IIS.Nginx.NodeJs Express,也可 ...

  6. [Java] Spring boot2 整合 Thymeleaf 后 去除模板缓存

    Spring boot2 整合 Thymeleaf 后 去除模板缓存 网上好多文章只是简单粗暴的说,在 application.properties  做如下配置即可: #Thymeleaf cach ...

  7. AngularJs 禁止模板缓存

    因为AngularJs的特性(or 浏览器本身的缓存?),angular默认的HTML模板加载都会被缓存起来.导致每次修改完模板之后都得经常需要清除浏览器的缓存来保证浏览器去获得最新的html模板,自 ...

  8. windows+linux开发环境 解决laravel blade模板缓存问题

    编码环境windows10 编码IDE:phpstorm 2016.2 PHP框架:laravel5.3 + 代码运行环境:centos7 + nginx 在开发过程中,上传blade模板文件到lin ...

  9. $smary模板缓存

    <?php //引入配置文件 $fillname="../cache/testhuancun.html"; //设置一个缓存时间 $time=; //判断如果缓存文件不存在的 ...

随机推荐

  1. PID控制器(比例-积分-微分控制器)- IV

    调节/测量放大电路电路图:PID控制电路图 如图是PlD控制电路,即比例(P).积分(I).微分(D)控制电路. A1构成的比例电路与环路增益有关,调节RP1,可使反相器的增益在0·5一∞范围内变化; ...

  2. 解决 Mac 的 Terminal 中,Java 乱码的问题

    在 .bash_profile 文件中,增加如下行: export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 然后,重新加载该配置 source .bash_pr ...

  3. idea html,js修改不用重启进程

    1Setting -> build-compiler ---勾选  Build project automatically选项 2 快捷键Ctrl + Shift + A查找registry命令 ...

  4. Gson 与 fastJson 在使用上的差异(fastJson的优点)

    一.android 常用的json解析方式 Android 开发上常用的json解析方式有:Gson, fastJson,jackson. 因为jackjson jar包会比较大点(700+k),Gs ...

  5. Java Web开发总结(一)

    1.如何解决 tomcat 中文乱码问题? 2.如果某个Servlet的映射路径仅仅为一个正斜杠(/),那么这个Servlet就成为当前Web应用程序的缺省Servlet. <!-- 将Serv ...

  6. [Java] LinkedHashMap 源码简要分析

    特点 * 各个元素不仅仅按照HashMap的结构存储,而且每个元素包含了before/after指针,通过一个头元素header,形成一个双向循环链表.使用循环链表,保存了元素插入的顺序. * 可设置 ...

  7. MySql之视图的使用

    一:视图是什么 视图相当于一个窗口,一个基于具体数据库表.定义了相关查询规则 的窗口. 建立视图,可以重用一些复杂的查询语句.    建立视图,相当于定义了一系列查询操作:从视图查询数据,相当于在调用 ...

  8. 【PMP】项目风险管理~重点知识

    1.什么是风险,项目的风险从哪里来? 开展项目,不仅要面对各种制约因素和假设条件,而且还要应对可能相互冲突和不断变化的相关方期望.组织应该有目的的以可控方式去冒项目风险,以便平衡风险和回报,并创造价值 ...

  9. 五种常见的ASP.NET安全缺陷

    保证应用程序的安全应当从编写第一行代码的时候开始做起,原因很简单,随着应用规模的发展,修补安全漏洞所需的代价也随之快速增长.根据IBM的系统科学协会(SystemsSciencesInstitute) ...

  10. wkhtmlpdf安装以及中文乱码

    见此页http://www.cnblogs.com/day959/p/6652726.html