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. Qt3D C++Read FBO
Qt 6.11 is out! See what's new in the release blog

Qt3D C++Read FBO

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 1 Posters 1.0k 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.
  • J Offline
    J Offline
    jimfar
    wrote on last edited by
    #1

    how to read FBO by c++ in qt3d?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jimfar
      wrote on last edited by
      #2

      ok make it. i found a way
      Qt3DExtras::Qt3DWindow m_window;
      auto m_3drender = new Qt3DExtras::QForwardRenderer;
      auto capture = new Qt3DRender::QRenderCapture;
      m_3drender->setParent(capture);
      m_window.setActiveFrameGraph(capture);
      auto m_shadercapture = new MyShaderCapture(capture, NULL);

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jimfar
        wrote on last edited by
        #3

        class MyShaderCapture : public QObject
        {
        Q_OBJECT
        public:
        MyShaderCapture(Qt3DRender::QRenderCapture* capture, QLabel imageLabel)
        : m_capture(capture)
        , m_reply(nullptr)
        , m_imageLabel(imageLabel)
        , m_continuous(false)
        {
        }
        public slots:
        void onCompleted()
        {
        QObject::disconnect(connection);
        emit sg2handleshaderreply( m_reply->image() );
        //m_imageLabel->setPixmap();
        //m_reply->saveImage("capture.bmp");
        delete m_reply;
        m_reply = nullptr;
        if (m_continuous)
        capture();
        }
        void setContinuous(bool continuos)
        {
        m_continuous = continuos;
        }
        void capture()
        {
        if (!m_reply) {
        m_reply = m_capture->requestCapture();
        connection = QObject::connect(m_reply, &Qt3DRender::QRenderCaptureReply::completed,
        this, &MyShaderCapture::onCompleted);
        }
        }
        signals:
        void sg2handleshaderreply(QImage&img);
        private:
        Qt3DRender::QRenderCapture
        m_capture;
        Qt3DRender::QRenderCaptureReply *m_reply;
        QMetaObject::Connection connection;
        QLabel *m_imageLabel;
        bool m_continuous;
        };
        hope help others for this func

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jimfar
          wrote on last edited by
          #4

          who could told me how to read the fragment shader mutilply outputs?Many thanks

          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