首页 > 其他分享 >osg qt场景中节点去除透明

osg qt场景中节点去除透明

时间:2024-02-07 22:26:57浏览次数:24  
标签:blendFunc 1.0 qt stateState blendColor StateAttribute 节点 osg

 

osg qt场景中节点的透明属性消除

 

{
    osg::ref_ptr<osg::StateSet> stateState = north_wall_geode->getOrCreateStateSet();
    stateState->setMode(GL_BLEND, osg::StateAttribute::ON);
    stateState->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
    stateState->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);

    stateState->setAttributeAndModes(wall_material2, osg::StateAttribute::ON);

    osg::ref_ptr<osg::BlendColor> blendColor = new osg::BlendColor(osg::Vec4(1.0f, 1.0f, 1.0f, 0.0f));
    osg::ref_ptr<osg::BlendFunc> blendFunc = new osg::BlendFunc();

    stateState->setAttributeAndModes(blendFunc, osg::StateAttribute::ON);
    stateState->setAttributeAndModes(blendColor, osg::StateAttribute::ON);

    blendFunc->setSource(osg::BlendFunc::CONSTANT_ALPHA);
    blendFunc->setDestination(osg::BlendFunc::ONE_MINUS_CONSTANT_ALPHA);

    blendColor->setConstantColor(osg::Vec4(1.0f, 1.0f, 1.0f, 0.999f));
}

 

 

 

 

##############################

标签:blendFunc,1.0,qt,stateState,blendColor,StateAttribute,节点,osg
From: https://www.cnblogs.com/herd/p/17923660.html

相关文章

  • 使用 Etcd 快照文件恢复 Etcd 数据:应对单节点及高可用集群情况
    1、概述在Kubernetes集群中,所有操作的资源数据都存储在Etcd数据库上。为了确保在节点故障、集群迁移或其他异常情况下能够尽快恢复集群数据,我们需要定期对Etcd数据进行容灾备份操作。在Kubernetes集群中,可以非常方便的针对Etcd数据进行备份,通常,只需在一个节点......
  • centos7安装posgresql
    安装#安装源sudoyuminstall-yhttps://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm#安装PostgreSQLcentos7上安装更高版本缺依赖,比较麻烦sudoyuminstall-ypostgresql14-server#初始化数据库sudo/usr/......
  • Qt processEvents - 解决线程中事件阻塞(如槽函数被阻塞)
    百度了一会,发现没太有文字讲这件事情,因此整理成文字记录一下。processEvents介绍长时间运行的操作可以调用processEvents()保持应用程序响应能力。voidQCoreApplication::processEvents(QEventLoop::ProcessEventsFlagsflags=QEventLoop::AllEvents)根据指定的条件为调......
  • vue2中el-tree组件实现双击树的节点来修改节点名称
    目标在没双击之前,树的节点是文本样式。在双击之后,节点位置变成输入框形式,原节点的名称显示在输入框中,可以进行修改。修改完毕之后,当输入框失去焦点的时候,输入框消失,又变成原本的文本样式,并且显示的是修改后的节点名称。添加一个树<template><div><el-tree......
  • ROS问题: libQt5Core. so.5:无法打开共享对象文件:没有那个文件或目录
    当运行下面命令报错时ros2runturtlesimturtlesim_node错误信息:/opt/ros/foxy/lib/turtlesim/turtlesim_node:errorwhileloadingsharedlibraries:libQt5Core.so.5:cannotopensharedobjectfile:Nosuchfileordirectory最佳答案 我用这个方法,来自h......
  • pyqt的简介与使用说明
    一,概念1,QT是一个强大的工具库,提供可视化窗口,它是基于C++开发的。pyqt和pyside这两个python库使得可以用python来调用QT库。Pyqt出现更早,社区资料更多。二者的主要区别在许可证上。【PyQt有两种许可协议,一种是GPLv3许可协议,另一种是需要授权的商业许可协议,GPLv3许可协议是指,如果的你......
  • 【JAVA】Java 使用 XPath表达式定位节点读取自定义XML方法
    *加载配置文件节点*@paramattributeValue节点属性值*@paramareaCode节点属性值*/publicstaticMap<String,String>getConfigXml(StringattributeValue,StringareaCode){StringfilePath="config.xml";Map<St......
  • QT5气象例子
    天气预报:'''项目实战:天气信息查询'''importsysfromPyQt5.QtWidgetsimportQApplication,QMainWindowfromWeatherWinimportUi_FormimportrequestsclassMainWindow(QMainWindow):def__init__(self,parent=None):......
  • pyqt报错、python报错:src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: 没
    报错信息:-DNDEBUG-fwrapv-O2-Wall-fPIC-O2-isystem/home/devil/anaconda3/envs/91/include-fPIC-O2-isystem/home/devil/anaconda3/envs/91/include-fPIC-I/usr/local/include-I/usr/include-I/home/devil/anaconda3/envs/91/include/python3.10-csrc/pyaudio/d......
  • log for qt
    voidcustomMessageHandler(QtMsgTypetype,constQMessageLogContext&context,constQString&msg){Q_UNUSED(context);QStringdt=QDateTime::currentDateTime().toString("dd/MM/yyyyhh:mm:ss");QStringtxt=QString("[%1]......