[Qt-interest] GLSL and two semi-transparent textures
Josiah Bryan
jbryan at productiveconcepts.com
Wed Aug 11 03:31:11 CEST 2010
Josiah Bryan wrote:
> Just one problem - When I draw two textures, one over top of the other
> (think a PiP), and the top (pip) has an alpha channel (say, the Qt cube
> logo from the pbuffers examples), the qglClearColor shows thru in the
> transparent areas of the top texture, NOT the bottom texture!
>
> Screen shot of the problem here:
> http://corp.productiveconcepts.com/dropbox/TextureSnapshot.jpg
Minor update as to what I've tried since sending the first email, still
no luck:
- I've tried changing the clear color call from:
qglClearColor(Qt::blue);
to
glClearColor(0.0,0.0,1.0,0.0);
(Same result)
-I've tried EVERY combination of glBlendFunc calls from
qt/src/opengl/qpaintengine_opengl.cpp:
QOpenGLPaintEngine::updateCompositionMode(QPainter::CompositionMode) -
no luck at all getting it to combine correctly. No combination of
glBlendFunc calls EVER gets the rear texture to show thru the
transparent areas of the front texture.
- I've tried setting a different glBlendFunc for the front texture than
the rear texture, grasping as straws such as here:
http://hacksoflife.blogspot.com/2010/02/alpha-blending-back-to-front-front-to.html
- I've tried setting a 0.75 opacity using a call like:
glColor4f(opacity,opacity,opacity,opacity) - no change in transparency
to either texture (likely due to the GLSL usage.) - This does work when
not using GLSL, but I need the GLSL to do the YUV conversion on the GPU
for formats that use YUV instead of RGB32 and friends.
- I've tried several different PNGs - thinking the original png image
had a bad alpha channel or something. Nope. All work as expected.
- I've tried setting a hard coded alpha value (something like 0.5) in
the GLSL fragment shader 'qt_glsl_argbShaderProgram' (like 63 approx in
the original linked sources) - just blends with the clear color still,
not with the rear texture.
Does any of this spark any ideas in anyones mind on how to actually
blend the front and back textures properly while still using GLSL?
Is it because I'm using GLSL instead of ArbFp shaders? Just a random
thought - qpaintengine_opengl.cpp seems to use ArbFp shaders intead of
GLSL - just wondering. Can anybody at Trolltech comment on that with
regards to this problem?
Thanks for your help.
Regards,
Josiah Bryan
More information about the Qt-interest-old
mailing list