Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Unable to take screenshot of Qt3D window with transparent background on Mac

    General and Desktop
    qt3d qt3dwindow qforwardrender defaultframegra qt3drender
    2
    2
    403
    Loading More Posts
    • 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.
    • P
      poortipant last edited by

      Hi,

      I have an application that renders 3d (dae) files.
      I also have a feature on my application - to take screenshots of the current scene.

      I am using Qt 5.12 on a Mac 10.14.6

      I implemented functionality so that the screenshot could be taken with a transparent
      background. This is working fine on Windows, but for some unknown reason it does not make the background transparent on Mac.

      This is the code,

      
      Qt3DRender::QRenderCaptureReply m_renderCaptureReply;
      ...
      ...
      QColor color = QColor(255, 255, 255, 0);
      if (color.isValid())
      	view->defaultFrameGraph()->setClearColor(color);
      
      m_renderCaptureReply = m_renderCapture->requestCapture();
      connect(m_renderCaptureReply, SIGNAL(completed()), this, SLOT(saveImageToFile()));
      
      
      
      void My3DQtViewer::saveImageToFile()
      {
          QImage image(m_renderCaptureReply->image().size(), QImage::Format_ARGB32);
          image.save(m_screenshotfilename, "PNG");
      }
      
      

      The image is being saved as png but with a white background.

      Any ideas what's missing?

      Thanks

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        I can't answer to that directly.

        Can you provide a minimal compilable example that shows that behaviour ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • First post
          Last post