Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QRenderCapture help

QRenderCapture help

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 707 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.
  • A Offline
    A Offline
    AndersDK
    wrote on last edited by
    #1

    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?

    ODБOïO 1 Reply Last reply
    0
    • A AndersDK

      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?

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AndersDK
        wrote on last edited by AndersDK
        #3

        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

        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