Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Crash with QQuickFrameBufferObject
Qt 6.11 is out! See what's new in the release blog

Crash with QQuickFrameBufferObject

Scheduled Pinned Locked Moved Solved Qt for Python
qt for pythonpyside2
2 Posts 1 Posters 729 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    daljit97
    wrote on last edited by
    #1

    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):
            super().__init__(parent)
            print("Creating renderer")
    
        def createFrameBufferObject(self, size):
            format = QOpenGLFramebufferObjectFormat()
            format.setAttachment(QOpenGLFramebufferObject.Depth)
            return QOpenGLFramebufferObject(size, format)
        
        def synchronize(self, item):
            print("Synchronizing")
    
        def render(self):
            print("Rendering")
    
    class OpenGLCanvas(QQuickFramebufferObject):
        def __init__(self, parent=None):
            super().__init__(parent)
        
        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
    
    Window{
        id: win
        visible: true
    
        OpenGLCanvas{
            anchors.fill: parent
        }
    }
    

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

    1 Reply Last reply
    0
    • D Offline
      D Offline
      daljit97
      wrote on last edited by
      #2

      Someone has answered this on StackOverflow.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved