zoukankan      html  css  js  c++  java
  • 模型自身面片重合引起的闪烁破损解决方法

    当面片重合的时候,会出现Z-Fighting闪烁现象,可以通过glPolygonOffset来解决

    但是一个几何体Geode自身部分面片重合,例如飞机盘旋飞行对应的高度面,就需要使用GL_SAMPLE_ALPHA_TO_COVERAGE_ARB替换GL_BLEND

    //geom->getOrCreateStateSet()->setMode(GL_BLEND,osg::StateAttribute::ON | osg::StateAttribute::PROTECTED | osg::StateAttribute::OVERRIDE);
    geom->getOrCreateStateSet()->setMode(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB, osg::StateAttribute::ON | osg::StateAttribute::PROTECTED | osg::StateAttribute::OVERRIDE);

    有时候可能需要设置

    osg::DisplaySettings::instance()->setNumMultiSamples(4);//多重采样设置反走样

    或者

    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits();
    traits->samples = 4;//多重采样设置反走样
    traits->windowDecoration = false;
    traits->x = nX;
    traits->y = nY;
    traits->width = nW;
    traits->height = nH;
    traits->doubleBuffer = true;
    traits->inheritedWindowData = pInheritedWindowData;

  • 相关阅读:
    python--初识面向对象
    python--内置函数, 匿名函数
    P2249 【深基13.例1】查找
    P5143 攀爬者
    P1116 车厢重组
    P1059 明明的随机数
    P1152 欢乐的跳
    字符数组
    nth_element(取容器中的第n大值)
    费曼学习法
  • 原文地址:https://www.cnblogs.com/coolbear/p/10195361.html
Copyright © 2011-2022 走看看