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

QRenderCapture help



  • Hello

    I create a 3D image in my GUI that look something like this:

    0_1530607880800_cb461333-3a4e-415f-9a8c-b3d6881e3165-image.png

    I create it like this

    Qt3DExtras::Qt3DWindow *view = new Qt3DExtras::Qt3DWindow();
    view->defaultFrameGraph()->setClearColor(QColor(QRgb(0x4d4d4f)));
    QWidget *container = QWidget::createWindowContainer(view);
    
    Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
    

    Then I add camera, light and objects to the rootEntity and add the root to the view. As you can see from the image, it works ok.

    Now I would like to save the image to a png file (preferable with the black background as transparent if possible).

    I found that QRenderCapture might be the way to go, and found the following example:

    http://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/rendercapture-cpp

    However, when I try to implement it, the reply never completes.

    I also tried to save the container widget as an image, but then i only get the black background.

    Do anyone know how to save the 3D rendered image to a png file?



  • @AndersDK Hi,
    Do you need a 'screenshot' ?



  • A screenshot could work, but it should only be of the 3D image part of my GUI. Also I guess if I use a screen shot, I can't make the black background transparent?

    Furthermore I would like to get the image, without showing it in the GUI. I mean render the 3D part, but not showing it to the user. Don't know if that is even possible


Log in to reply