xuyao 发表于 2017-6-20 19:32:44

怎么写的代码GLSLColorFilter,求大神赐教

osgEarth中有个加载云层的earth文件例子,现要实现动态的加载云图的功能。
下面是earth文件中jpg图像透明相关的配置代码,但把这几句转化成代码不知怎么搞。
<color_filters>
                        <glsl>
                                color.a = color.r;
                        </glsl>
</color_filters>



osgEarth::Drivers::OSGOptions imagery;
imagery.url() = m_strUrl.toStdString();
imagery.profile() = osgEarth::ProfileOptions("global-geodetic");
osgEarth::ImageLayerOptions options(m_strUrl.toStdString(), imagery);
osgEarth::Util::GLSLColorFilter* pFilter = new osgEarth::Util::GLSLColorFilter;
//这一行应该怎么写啊(color.a = color.r)
options.colorFilters().push_back(pFilter);
m_pImageLayer = new osgEarth::ImageLayer(options);

xuyao 发表于 2017-6-20 22:44:45

osgEarth::Config config("glsl","color.a = color.r;" );
osgEarth::Util::GLSLColorFilter* pFilter = new osgEarth::Util::GLSLColorFilter(config);
options.colorFilters().push_back(pFilter);
页: [1]
查看完整版本: 怎么写的代码GLSLColorFilter,求大神赐教