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. Trouble to save a QT3D rendered scene to a image file?
Qt 6.11 is out! See what's new in the release blog

Trouble to save a QT3D rendered scene to a image file?

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 5 Posters 9.1k Views 4 Watching
  • 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.
  • S shangariLa

    @Flotisable , @guy-incognito , I kinds of get it working (partly) with the grabWindow approach. however the new issue is that even the onscreen view is changed, somehow the captured image is always stay the same (for example I changed the viewpoint) . Any clue why ? .

    FlotisableF Offline
    FlotisableF Offline
    Flotisable
    wrote on last edited by
    #7

    @shangariLa
    maybe the time you capturing the image is not correct.
    could you provide some code on how and when you capture the image?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      shangariLa
      wrote on last edited by shangariLa
      #8
      This post is deleted!
      FlotisableF 1 Reply Last reply
      0
      • S shangariLa

        This post is deleted!

        FlotisableF Offline
        FlotisableF Offline
        Flotisable
        wrote on last edited by
        #9

        @shangariLa
        I write a simple Qt 3D program to test it, and it works.

        maybe it's a silly question, but have you checked that the slot is triggered?
        and what does getView do, does it return the correct window?

        by the way, I do not set Qt3DExtras::Qt3DWindow as the child of QMainWindow, I'm not sure if it is the reason that you can't save correct image.

        S 1 Reply Last reply
        0
        • FlotisableF Flotisable

          @shangariLa
          I write a simple Qt 3D program to test it, and it works.

          maybe it's a silly question, but have you checked that the slot is triggered?
          and what does getView do, does it return the correct window?

          by the way, I do not set Qt3DExtras::Qt3DWindow as the child of QMainWindow, I'm not sure if it is the reason that you can't save correct image.

          S Offline
          S Offline
          shangariLa
          wrote on last edited by shangariLa
          #10

          @Flotisable , thanks for the info. In my code, there is a GUI window containing controls and the 3D rendered view is shown in a separate window (not child) . getview basically pass the Qt3DExtras::Qt3DWindow pointer back to the main window, and the slot function does get triggered. But as you pointed out, I have the similar concern that maybe QT3D does not work with widget window? it seems all the qt3d examples I saw so far always have 3D rendered view contained in the main window, not sure if there is any QT limitation? (I googled a bit, haven't found a sure answer for this).

          Anyone had the experience of rendering QT3D rendered view in a separate child window, in a widget-based application? Is there any QT limitation of doing this? Thanks.

          S 1 Reply Last reply
          0
          • S shangariLa

            @Flotisable , thanks for the info. In my code, there is a GUI window containing controls and the 3D rendered view is shown in a separate window (not child) . getview basically pass the Qt3DExtras::Qt3DWindow pointer back to the main window, and the slot function does get triggered. But as you pointed out, I have the similar concern that maybe QT3D does not work with widget window? it seems all the qt3d examples I saw so far always have 3D rendered view contained in the main window, not sure if there is any QT limitation? (I googled a bit, haven't found a sure answer for this).

            Anyone had the experience of rendering QT3D rendered view in a separate child window, in a widget-based application? Is there any QT limitation of doing this? Thanks.

            S Offline
            S Offline
            shangariLa
            wrote on last edited by
            #11

            Some interesting finding from this link (http://development.qt-project.narkive.com/PnbzvDC3/add-widgets-into-qt3d-window) , at the very end, Sean comments "We do not yet have any widget/Qt3D integrations." not sure if it is still apply for QT5.8?

            1 Reply Last reply
            0
            • H Offline
              H Offline
              HoTiX
              wrote on last edited by
              #12

              @shangariLa , I was able to embed a Qt3DWindow object into a QWidget using QWidget::createWindowContainter. The rendering works fine on Desktop (only tested on Linux) using Qt 5.8, but I'm having issues doing this for Android (which does not render anything). Look at the basicshape c++ example on how to do this. Currently, I don't think there's a direct QWidget-Qt3d integration in 5.8.

              S 1 Reply Last reply
              0
              • H HoTiX

                @shangariLa , I was able to embed a Qt3DWindow object into a QWidget using QWidget::createWindowContainter. The rendering works fine on Desktop (only tested on Linux) using Qt 5.8, but I'm having issues doing this for Android (which does not render anything). Look at the basicshape c++ example on how to do this. Currently, I don't think there's a direct QWidget-Qt3d integration in 5.8.

                S Offline
                S Offline
                shangariLa
                wrote on last edited by shangariLa
                #13

                @HoTiX , in your case, do you embed QT3D view in main GUI window (so there is only one window), or do you have it in separate window? In my case, I have it in separate window, the rendering part is mostly working (occasional crash) but having trouble to save the rendered image.
                At the moment, I can save the single capture with qrendercapture approach, but not continuous capture,

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  HoTiX
                  wrote on last edited by
                  #14

                  @shangariLa , in my case I embed the Qt3DWindow in a QMainWindow using the createWindowContainer and it does render fine on Desktop, but not on Android.

                  I tried to detach the Qt3DWindow into a separate window (QMainWindow and Qt3DWindow) and nothing is render to the Qt3DWindow. I can see that defaultFrameGraph()->setClearColor() works fines but nothing more is showed.

                  1 Reply Last reply
                  0
                  • FlotisableF Offline
                    FlotisableF Offline
                    Flotisable
                    wrote on last edited by
                    #15

                    I post my code, maybe you can find the difference between our method.

                    testcode

                    and I tried separate and embedded the window, all work fine, except that embed the window sometimes cause the app to crash when exit.

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      HoTiX
                      wrote on last edited by
                      #16

                      It was my mistake... I show() the window before even creating the scene. Anyway, I just wanted to replicate your issue, but I created my own in the process.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        shangariLa
                        wrote on last edited by
                        #17

                        I found a bug which cause the multi-capture failure. Now the original capture issue I posted are mostly solved. Thanks everyone for providing the info.
                        However, it still crashes or capture sometimes behave unexpectedly. By debugging, it seems some of the signal / slot connection do not always behave as expected. how do you guys debug the Qt signal connection issues? other tools? I havn't figure out how to use debugger for this purpose.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #18

                          Hi,

                          An additional tool that might be of interest is KDAB's GammaRay.

                          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
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved