[Interest] Using QSGVertexColorMaterial transparency

Al-Khanji Louai louai.al-khanji at theqtcompany.com
Tue Nov 11 13:11:07 CET 2014


Why not do this directly in QML with Rectangle items? 

-- Louai


> -----Original Message-----
> From: interest-bounces+louai.al-khanji=theqtcompany.com at qt-project.org
> [mailto:interest-bounces+louai.al-khanji=theqtcompany.com at qt-
> project.org] On Behalf Of Nuno Santos
> Sent: Tuesday, November 11, 2014 1:17 PM
> To: Interests Qt
> Subject: [Interest] Using QSGVertexColorMaterial transparency
> 
> Hi,
> 
> I want to give a flashing effect on a quad. My idea is to draw two quads. One
> with the base color, and one above it with a white color but with
> transparency oscillating. This will give the flashing effect.
> 
> I'm not being able to do it with QSGVertexColorMaterial. There is no opacity
> on quad there is placed above. I have found the following post answer but I
> still can't understand it quite well.
> 
> "The blend mode used by the scene graph is glBlendFunc(GL_ONE,
> GL_ONE_MINUS_SRC_ALPHA) which gives you premultiplied blending. A
> "valid" color in premultiplied mode must have r <= a (same for g and b of
> course). If it doesn't, then that color channel will overflow, giving you
> additive blending instead."
> 
> Will it be possible to implement this with a QSGVertexColorMaterial?
> 
> // quad below
> 
> v[0].set(_rect.left(), _rect.bottom(), r, g, b, a);
> v[1].set(_rect.left(), _rect.top(), r, g, b, a);
> v[2].set(_rect.right(), _rect.top(), r, g, b, a);
> 
> v[3].set(_rect.left(), _rect.bottom(), r, g, b, a);
> v[4].set(_rect.right(), _rect.top(), r, g, b, a);
> v[5].set(_rect.right(), _rect.bottom(), r, g, b, a);
> 
> // flashing quad above
> 
> a=128+128*qSin(phase),r=0xff,g=0xff,b=0xff;
> 
> v[6].set(_rect.left(), _rect.bottom(), r, g, b, a);
> v[7].set(_rect.left(), _rect.top(), r, g, b, a);
> v[8].set(_rect.right(), _rect.top(), r, g, b, a);
> 
> v[9].set(_rect.left(), _rect.bottom(), r, g, b, a);
> v[10].set(_rect.right(), _rect.top(), r, g, b, a);
> v[11].set(_rect.right(), _rect.bottom(), r, g, b, a);
> 
> Thanks,
> 
> Regards,
> 
> Nuno
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list