Important: Please read the Qt Code of Conduct -

Crash with QQuickFrameBufferObject

  • I am trying to create a simple QQuickFrameBufferObject in order to render some custom opengl textures in Qt Quick. So I decided to test it with PySide2. Here is a simple implementation:

    from PySide2.QtQuick import QQuickFramebufferObject
    from PySide2.QtGui import QOpenGLFramebufferObjectFormat, QOpenGLFramebufferObject
    from PySide2.QtCore import QSize, Qt
    class FboRenderer(QQuickFramebufferObject.Renderer):
        def __init__(self, parent=None):
            print("Creating renderer")
        def createFrameBufferObject(self, size):
            format = QOpenGLFramebufferObjectFormat()
            return QOpenGLFramebufferObject(size, format)
        def synchronize(self, item):
        def render(self):
    class OpenGLCanvas(QQuickFramebufferObject):
        def __init__(self, parent=None):
        def createRenderer(self):
            return FboRenderer()

    Then to use this in QML I used:

        qmlRegisterType(OpenGLCanvas,"OpenGLCanvas", 1, 0, "OpenGLCanvas")
    import QtQuick 2.12
    import QtQuick.Window 2.12
    import OpenGLCanvas 1.0
        id: win
        visible: true
            anchors.fill: parent

    Now the app runs and displays "Creating renderer" but then it crashes after a couple of seconds.

  • Someone has answered this on StackOverflow.

  • Someone has answered this on StackOverflow.

Log in to reply