Hi Gunnar, thanks a lot for the explanation. With this solution the performance is good enough, and easy to implement.
The images I'm using for this are 1280x960 so I recon they won't be put in an atlas anyway even in 5.2. Still I guess the hints would be helpful when you get time to implement them. I'm planning to test the 5.2 beta as soon as possible, really looking forward to trying the new scenegraph! Regarding a big image like this, 1280x960, what kind of texture is Qt using internally for that? 2048x1024? Or is it using a non-"power-of-two" texture? Best regards, Ola 2013/10/23 Sletta Gunnar <gunnar.sle...@digia.com> > 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: > interest-bounces+gunnar.sletta=digia....@qt-project.org[interest-bounces+gunnar.sletta= > digia....@qt-project.org] på vegne av Ola Røer Thorsen [ > o...@silentwings.no] > Sendt: 22. oktober 2013 15:20 > To: interest@qt-project.org > 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 Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest