QML:如何将着色器效果与QtGraphic效果混合
QML: How to mix a shader effect with a QtGraphical Effect?
我试图实现的背景图像上有两种效果:波浪(着色器)效果和着色(QtGraphical)效果。 不幸的是,它们只单独出现(即一个图像是我背景上的波浪效果,另一个只是我背景的着色)。
我想将两者合并为一张图像,但已经使用了几个小时。 有人知道怎么做吗?
Colorize {
anchors.fill: background
source: background
hue: 0.0
saturation: 0.5
lightness: -0.2
}
ShaderEffect {
height: intro_over ? 0 : parent.height;
width: intro_over ? 0 : parent.width;
property variant source: background
property real frequency: 8
property real amplitude: 0.1
property real time: 0.0
// Animation stuff
fragmentShader: "
varying highp vec2 qt_TexCoord0;
uniform sampler2D source;
uniform lowp float qt_Opacity;
uniform highp float frequency;
uniform highp float amplitude;
uniform highp float time;
void main() {
highp vec2 pulse = sin(time - frequency * qt_TexCoord0);
highp vec2 coord = qt_TexCoord0 + amplitude * vec2(pulse.x, -pulse.x);
gl_FragColor = texture2D(source, coord) * qt_Opacity;
}"
}
使用 ShaderEffectSource
.在您的示例中,为Colorize
项添加一个id
,并创建一个ShaderEffectSource
作为ShaderEffect
的源:
Colorize {
id: colorize
anchors.fill: background
source: background
hue: 0.0
saturation: 0.5
lightness: -0.2
}
ShaderEffect {
height: intro_over ? 0 : parent.height;
width: intro_over ? 0 : parent.width;
property variant source: ShaderEffectSource {
sourceItem: colorize
hideSource: true
}
property real frequency: 8
property real amplitude: 0.1
property real time: 0.0
}
相关文章:
- 混合组合和继承的C++问题
- 在混合代码库中将C转换为C++时出现许多包含错误
- D3D11-将混合权重和索引传递到顶点着色器
- C++分数混合比较运算符错误
- 是否可以混合使用SFINAE和模板专业化?
- 如何在 Python C++ 混合库中调试非确定性分段错误?
- 使用 Boost.Spirit 解析具有混合数据类型的 OBJ 文件?
- C++11 中的混合列表初始化
- C++以迭代方式搜索混合类型地图
- #pragma(*诊断)当将Clang分析器与GCC编译器混合时
- 混合 Rcpp 模块和 Rcpp::export
- C++/CLI 混合托管/本机 DLL 不起作用
- 在C++中混合覆盖和重载
- 关于 Direct3D9 中的 alpha 混合的问题
- 使用英特尔内部函数 (AVX) 中的混合说明
- C++ 中混合二进制/文本日志记录的最佳做法
- Fortran 和 C++ 的混合编程:Fortran 不能调用C++子程序
- 错误:在 C++ 目标 c 混合'self'使用未声明的标识符
- 是否有一个版本的glCopyImageSubData在Openg GL中使用混合?
- QML:如何将着色器效果与QtGraphic效果混合