79176156

Date: 2024-11-11 01:38:04
Score: 0.5
Natty:
Report link

Solved. I managed to get it working. Trick was to link the FrameGraph to the QRenderCapture instance. Here is the code added to init()

self.render_capture = QRenderCapture()
self.view.activeFrameGraph().setParent(self.render_capture)
self.view.setActiveFrameGraph(self.render_capture)

The other gotcha is to wait for the rendering to complete. Here is how I implemented it.

def capture_image(self):
   self.reply = self.render_capture.requestCapture()
   loop = QEventLoop()
   self.reply.completed.connect(loop.quit)
   QTimer.singleShot(200, loop.quit)  # Timeout after 1 second
   loop.exec()
        
   image = self.reply.image()
   image.save("capture_output.jpg", "JPG")

I just can't believe how poorly documented this Qt3D library is...

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: MAX