参考帖子:

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. 关于ADO.Net SqlConnection的性能优化

    Connections Database connections are an expensive and limited resource. Your approach to connection ...

  2. 阿里云 RDS 与 DRDS 学习了解

    RDS 主页:https://help.aliyun.com/document_detail/26092.html?spm=5176.7741872.6.539.4h8LSC DRDS 主页:http ...

  3. 临时和永久关闭Selinux

    临时关闭: [root@localhost ~]# getenforceEnforcing [root@localhost ~]# setenforce 0[root@localhost ~]# ge ...

  4. art.template 循环里面分组。

    后台提供给我们一个数组,我们要用模版实现上面的格式输出怎么版呢? 下面就是解决方案: <h2>循环4个一组</h2> <script type="text/ht ...

  5. Android中将十六进制 颜色代码 转换为int类型数值

    Android中 将 十六进制 颜色代码 转换为  int   类型数值 方法  : Color.parseColor("#00CCFF") 返回 int 数值 来自为知笔记(Wi ...

  6. IOPS计算

    Device Type IOPS 7,200 rpm SATA drives HDD ~75-100 IOPS[2] 10,000 rpm SATA drives HDD ~125-150 IOPS[ ...

  7. 常用CTPN、CRNN文本检测识别框架

    一.SWT识别: yestinsong/Text-Detection( Text Detection System with MSER , SWT and Text Verification(fft ...

  8. 结巴分词和自然语言处理HanLP处理手记

    手记实用系列文章: 1 结巴分词和自然语言处理HanLP处理手记 2 Python中文语料批量预处理手记 3 自然语言处理手记 4 Python中调用自然语言处理工具HanLP手记 5 Python中 ...

  9. 【PMP】项目采购管理~重点知识

    1.合同的类型与区别 固定总价(FFP):大多数买方都喜欢这种合同,因为货物的采购价格在一开始就已确定,并且不允许改变(除非工作范围发生变更) 总价加激励费用(FPIF):这种总价合同给买方和卖方提供 ...

  10. pycharm调整代码长度分割线

    1.File ->  Settings  ->  Code Style -> Right margin (columns) 的值为80,大功告成. 2.具体设置的数值可以根据个人电脑 ...