c++ - 在 openFrameworks 中,是否可以在使用 ofxPiMapper 时更改我的 fbo 源的不透明度?
问题描述
在 openFrameworks 中,是否可以在使用 ofxPiMapper 时更改我的 fbo 源的不透明度?
解决方案
弄清楚了:
进入 addons/ofxPiMapper/src/Surfaces/SurfaceStack.cpp 在 SurfaceStack::draw() 中,将 ofEnableAlphaBlending() 添加到所有 glblend 内容下方 for 循环内的 if 语句中。
void SurfaceStack::draw(){
for(int i = 0; i < _surfaces.size(); ++i){
if(_surfaces[i]->getSource()->getType() == SourceType::SOURCE_TYPE_FBO){
glEnable(GL_BLEND);
glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
ofEnableAlphaBlending(); //<-- here
}else{
ofEnableAlphaBlending();
}
_surfaces[i]->draw();
}
}
推荐阅读
- c# - 使用 .NET 插入块不使用文件搜索路径来定位文件
- javascript - 我可以订阅正在初始化的变量吗?
- java - AWS Java SDK 2 S3 复制对象
- javascript - 将多个列表组合到单个数组
- go - 如何在不使用字段名称作为字符串的情况下获取字段的标签?
- javascript - 从没有jQuery的javascript调用python函数
- c++ - 返回一个 std::string,转换为 char*
- sql-server - SQL Server 不使用特定索引
- api - 如何让 Fluentd HTTP 插件在响应正文中返回数据
- python - Flask/Jinja2 - 包含相对于当前模板的模板