Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Render EGLImageKHR into QOpenGLFramebufferObject
QtWS25 Last Chance

Render EGLImageKHR into QOpenGLFramebufferObject

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 2 Posters 559 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.
  • Z Offline
    Z Offline
    zhangzheng
    wrote on last edited by
    #1

    I have displayed the camera image in QML.But when I rotate the target model, I get a rip.like this:
    image1.jpg image2.jpg
    this is my some code:

    void updateCameraTexture(){
        ......
        EGLImageKHR img = eglCreateImageKHR(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, 0, attribs);
        glBindTexture(GL_TEXTURE_EXTERNAL_OES, m_rightTexture);
        lEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, (GLeglImageOES)img);
    }
    
    class Pan3DInFboRenderer : public QQuickFramebufferObject::Renderer
    {
        void render()
        {
            ......
            updateCameraTexture();
            glBindTexture(GL_TEXTURE_EXTERNAL_OES, m_rightTexture);
            glDrawElements(GL_TRIANGLES, m_undistortRight.m_size, GL_UNSIGNED_SHORT,(const void*)((m_undistortRight.m_offset) * sizeof(unsigned short)));
            update();
        }
        QOpenGLFramebufferObject *createFramebufferObject(const QSize &size)
        {
            QOpenGLFramebufferObjectFormat format;
            format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
            format.setSamples(4);
            return new QOpenGLFramebufferObject(size, format);
        }
        ......
    }
    

    But this is normal:

    void updateCameraTexture(){
        ......
        tex = QImage(":/picture/right.jpg").convertToFormat(QImage::Format_RGBA8888);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.width(), tex.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, tex.bits());
    }
    
    class Pan3DInFboRenderer : public QQuickFramebufferObject::Renderer
    {
        void render()
        {
            ......
            updateCameraTexture();
            glBindTexture(GL_TEXTURE_2D, m_rightTexture);
            glDrawElements(GL_TRIANGLES, m_undistortRight.m_size, GL_UNSIGNED_SHORT,(const void*)((m_undistortRight.m_offset) * sizeof(unsigned short)));
            update();
        }
        QOpenGLFramebufferObject *createFramebufferObject(const QSize &size)
        {
            QOpenGLFramebufferObjectFormat format;
            format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
            format.setSamples(4);
            return new QOpenGLFramebufferObject(size, format);
        }
        ......
    }
    
    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zhangzheng
      wrote on last edited by
      #2

      On the left is also a QQuickFramebufferObject: : the Renderer,cannot rotate.
      the right is like :
      Appeared torn basic reason lies in the graphics output frame rate is faster than the display (for example GTX1080 run most of the 1080 p of the game on the market can easily break the frame rate, but most players home display refresh rate is 60 hz), monitor the processing speed can't keep up with the graphics card, on display the first frame of video card lost over time, the frame 2, again, leads to the same picture appear at the same time two frame 1, 2, tear is produced
      But it's not,Because tear doesn't appear on the left.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zhangzheng
        wrote on last edited by
        #3

        use Triple Buffering to fix this problem。

        1 Reply Last reply
        0
        • E Offline
          E Offline
          Ekrem
          wrote on last edited by
          #4

          Hello @zhangzheng ,

          I tried to do similar example and having some trouble.I posted a question to : https://forum.qt.io/topic/122310/creating-eglimagekhr-image-from-render-buffer.

          Could you please check and lemme know if you have an idea ?

          Regards

          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