You can use a ShaderEffect element. It does not use an FBO for plain Image
types.
Image {
id: myImage
visible: false
}
ShaderEffect {
property variant source: myImage
anchors.fill: myImage
fragmentShader: "
varying highp vec2 qt_TexCoord0;
uniform lowp vec4 sampler2D source;
void main() {
gl_FragColor = texture2D(source, qt_TexCoord0).rrra;
}
"
}
In Qt 5.0 and 5.1 this will use the texture directly without any extra copies.
In 5.2 the image's texture might be in an atlas and will currently be copied
out of the atlas into its own texture which is then used directly. I want to
add some performance hints to the ShaderEffect to avoid the
copy-out-of-the-atlas (which is needed for compatibility right now), but I'm
not sure those will make 5.2.
The other alternative is to implement a custom material using the QSG API
directly. Then you get the best possible performance.
cheers,
Gunnar
________________________________________
Fra: [email protected]
[[email protected]] på vegne av Ola
Røer Thorsen [[email protected]]
Sendt: 22. oktober 2013 15:20
To: [email protected]
Emne: [Interest] use custom fragment shader for Quick2 Image item
Hi all,
I want to use a custom fragment shader when rendering a Image item. Is it
possible to set the shader to use directly somehow? That is, I want to use a
custom shader instead of the "passthrough" fragment shader used in the Image
element.
I have tried using the QtGraphicalEffects (GammaAdjust), but the performance is
not good enough on my target platform (Omap 3530). ShaderEffect elements work,
but they also seem to render via another render-texture, again with a
performance loss.
Best regards,
Ola
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest