Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QQuickView, QQuickWindow, QOpenGLFramebufferObject
Forum Updated to NodeBB v4.3 + New Features

QQuickView, QQuickWindow, QOpenGLFramebufferObject

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 2 Posters 4.5k Views 1 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 Offline
    S Offline
    Skylar
    wrote on last edited by
    #1

    Hello,

    I'm would like to access the QQuickView framebuffer image just afterRendering.

    I can add a new QopenGLFramebuuferObject using the AfterRendering slot but it' not what I want.

    I would like to export the current QQuickView framebuffer (or access it if possible) to change e.g. the pixels positions.

    I tested to add a custom buffer to avoid using the default one but I can't find the way using setRenderTarget.

    May you please advise me ?

    Regards
    Skylar

    In most cases, the bug is mine. But of the remaining lines are correct.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Skylar
      wrote on last edited by
      #2

      Looks likes I'm directly with the framebuffer.

      Attempting to use the this->renderTarget()->toImage() crash but simply reading the buffer I can have is as in qopenglframebufferobject.cpp

      QImage img(width(), height(),QImage::Format_RGB32);
      glReadPixels(0,0, width(),height(),GL_BGRA, GL_UNSIGNED_BYTE, img.bits());

      I was not expecting this way, still have something to understand.

      In most cases, the bug is mine. But of the remaining lines are correct.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        melghawi
        wrote on last edited by
        #3

        Do not use:

        @this->renderTarget()->toImage()@

        Have a look at this post "here.":http://qt-project.org/forums/viewthread/27117/

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Skylar
          wrote on last edited by
          #4

          Thank you, this way I think that you grab the window if I'm right.

          My final plan is to modify the image prior it's sent to the display driver.

          The point I need more to understand now would be ho to corretly specify an other framebuffer than the default one.

          In most cases, the bug is mine. But of the remaining lines are correct.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            melghawi
            wrote on last edited by
            #5

            Yes you are right however this action is a big performance hit and should be run in a separate thread if possible.

            I haven't tried this myself but have a look at this "QQuickWindow::setRenderTarget":http://qt-project.org/doc/qt-5.0/qtquick/qquickwindow.html#setRenderTarget. This allows you to set your own custom fbo as the render target for a specific window.

            I'm sure you have already thought about this but what about using shaders to achieve pixel/fragment manipulation before rendering?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Skylar
              wrote on last edited by
              #6

              Thank you, I look for AfterRendering and the shader manipulation can only be done BeforeRendering if I'm right.

              My problem is indeed in the correct use the the setRenderTarget.
              If you have a working code sampling I would be glad.

              In most cases, the bug is mine. But of the remaining lines are correct.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                melghawi
                wrote on last edited by
                #7

                Ah, yes of course my mistake. Shaders are applied before the final output. But if you want to change the positions of pixels then a pixel shader comes in real handy.

                As I've said before I have not played around with setRenderTarget but will give it a go when I have more time. What problems are you facing with this by the way?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Skylar
                  wrote on last edited by
                  #8

                  I don't find the correct way to change the QQuickView default framebuffer to an new explicit one.

                  In most cases, the bug is mine. But of the remaining lines are correct.

                  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