c++qtopenglgraphicsqglwidget

Qt QPainter in paintEvent eliminates the graphic drawn with paintGL


I have the following code

void QMyWidget::paintEvent(QPaintEvent *event)
{

    updateGL(); // This calls for initializeGL and then paintGL and draws a nice openGL 3D scene


    QPainter painter(this); 
    // Draw something with QPainter..
}

the problem is that the QPainter line calls several times initializeGL and paintGL and eventually creates a BLANK/GRAY area over my OpenGL rendered scene.. if I try to draw something like a drawText with the QPainter, the text is shown but the background of the text is a gray rect that covers ENTIRELY my OpenGL drawn scene.

What's wrong with this?


Solution

  • Solved: multi-pass rendering was deactivated so the scene was being rendered multiple times