zoukankan      html  css  js  c++  java
  • osg 自定义图元

    osg::ref_ptr<osg::Geode> OSG_Qt_::createBox()
    {
        osg::ref_ptr<osg::Geode> osg_geode = new osg::Geode;
        osg::ref_ptr<osg::TessellationHints> osg_hints = new osg::TessellationHints;
        osg::ref_ptr<osg::Box> osg_box = new osg::Box(osg::Vec3(0.0, 0.0, 0.0), 1.0, 0.5, 3.0);
        osg::ref_ptr<osg::ShapeDrawable> osg_shapedrawable = new osg::ShapeDrawable(osg_box,osg_hints.get());
    
        //设置颜色
        osg::ref_ptr<osg::Material> osg_material = new osg::Material;
        osg_material->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0,1.0,1.0,1.0));
        osg_material->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 1.0, 1.0, 1.0));
        osg_material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 1.0, 1.0, 1.0));
        osg_material->setShininess(osg::Material::FRONT_AND_BACK,60.0);
    
        //应用材质
        osg_geode->getOrCreateStateSet()->setAttributeAndModes(osg_material.get(),osg::StateAttribute::ON);
        //设置透明度
        osg_geode->getOrCreateStateSet()->setMode(GL_BLEND,osg::StateAttribute::ON);
    
        //设置精度
        osg_hints->setDetailRatio(0.5);
        osg_geode->addDrawable(osg_shapedrawable.get());
        return osg_geode;
    }

  • 相关阅读:
    Linux安装Oralce 11g问题
    Hadoop 2.X 集群安装
    Centos图形界面关闭与开启
    SecureCRT乱码
    Hadoop 1.X 集群安装
    ThinkPad E430c 开机启动
    Node.js运行端口修改
    Node.js代理设置
    Github安装过后删除右键菜单选项
    吴恩达深度学习笔记 第四章作业1
  • 原文地址:https://www.cnblogs.com/herd/p/11070466.html
Copyright © 2011-2022 走看看