[Qt-interest] a bug in QGraphicsScene

Samuel Rødal samuel.rodal at nokia.com
Thu Aug 19 13:37:35 CEST 2010


On 08/18/2010 08:20 PM, ext Yifei Li wrote:
> Bug description:
>
> Shapes/texts drawn using QPainterPath may not be displayed correctly if GL_DEPTH_TEST is enabled in OpenGL
>
> To reproduce:
> Do OpenGL rendering in QGraphicsScene::drawBackground with depth test enabled, and then Qt 2D painting in QGraphicsScene::drawForeground()
>
> Platform and Qt version:
> Qt4.6.2: this problem happened to me on Windows 7(from time to time) and MacOS(all the time).
>
> Qt4.5: I haven't had the problem with the same code on Windows XP.
>
> Yifei

If you use any raw OpenGL code while a painter is active you need to 
surround it with painter.beginNativePainting() and 
painter.endNativePainting() to let the paint engine know that OpenGL 
state might have changed. Also, any OpenGL state that is changed should 
be set back to the default state.

Between Qt 4.5 and Qt 4.6 the default OpenGL paint engine was changed 
from an OpenGL 1.x based paint engine to an OpenGL 2.x based paint 
engine, which explains the difference.

--
Samuel



More information about the Qt-interest-old mailing list