Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QQuickWidget - QOpenGLFramebufferObject::release() called from incompatible context



  • Hi all.

    I am trying to render a QQuickWidget (which contains a QML application) to an offscreen surface which I am rendering to a surface in my game. However I am encountering the following warning contantly and my application is leaking memory very quickly:

    QOpenGLFramebufferObject::release() called from incompatible context
    

    This is strange because if I swap the QQuickWidget for any normal QWidget derrived class (e.g. a QDial) I get absolutely no warnings / memory leakage.

    Does anyone have any idea why this is happening?

    My code looks roughly like this:

    // Variable types defined in header
    QOpenGLContext* openGLContext;
    QGraphicsScene* graphicsScene;
    QOpenGLFramebufferObject* openGLFrameBuffer;
    QOffscreenSurface* offscreenSurface ;
    
    // Render loop
    void Render()
    {
        openGLContext->makeCurrent( offscreenSurface );
        openGLFrameBuffer->bind();
    
        QOpenGLPaintDevice device( openGLFrameBuffer->size() );
        QPainter painter( &device );
        graphicsScene->render( &painter );
    
        openGLFrameBuffer->release();
    
        GLuint unTexture = openGLFrameBuffer->texture();
    
        ...
    

Log in to reply