[Interest] Draw a qimage with transparency on a QOpenGLPaintDevice

maitai maitai at virtual-winds.org
Mon May 2 11:37:02 CEST 2022


Hi,

I discovered that it does not behave always like that. It happens only 
when painting very quickly many small QImages with transparent areas.

And I found a way to fix it, but this is just adding mystery.

Instead of

pnt->drawImage(etc);

I do

pnt.beginNativePainting();
pnt.endNativePainting();
pnt->drawImage(etc);

This seems to force a kind of flush and all is fine after that.

Should I report a bug?

Thanks

Philippe

Le 01-05-2022 13:45, maitai a écrit :

> Hi,
> 
> I have some heavy rendering that I would like to speed up using openGL. 
> For the time being using only QPainter regular method but later some 
> native openGL code.
> 
> So instead of painting on a QImage, I am painting on a 
> QOpenGLPaintDevice. All is fine except one point: When the painter 
> draws a QImage containing alpha, these alpha pixels appear black. 
> CompositionMode is QPainter::CompositionMode_SourceOver and QImage 
> format for the source is QImage::Format_ARGB32_Premultiplied. Same code 
> painting in a QImage works fine.
> 
> I have tried to glEnable(GL_BLEND) and glEnable(GL_DEPTH_TEST) and some 
> others but that didn't fix the issue.
> 
> Any idea of what needs to be done ?
> 
> Many thanks in advance
> 
> Philippe Lelong
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220502/b4dba37e/attachment.htm>


More information about the Interest mailing list