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. Qt5 Multisampling using QOpenGLFrameBufferObject
Qt 6.11 is out! See what's new in the release blog

Qt5 Multisampling using QOpenGLFrameBufferObject

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.8k 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.
  • P Offline
    P Offline
    Pourya
    wrote on last edited by
    #1

    I need to perform multisampling in a Qt5 project but I am not sure how to use "QOpenGLFrameBufferObject":http://http://qt-project.org/doc/qt-5.0/qopenglframebufferobject.html to perform it. There is no example on how to do this as far as I searched and the documentation only mentions: "If you want to use a framebuffer object with multisampling enabled as a texture, you first need to copy from it to a regular framebuffer object using QOpenGLContext::blitFramebuffer()." My code currently looks like this:
    @//Enable FSAA for better output
    int vp[4];
    glGetIntegerv(GL_VIEWPORT, vp);
    if(m_lpFBO == NULL)
    {
    //MultiSampling set to 4 now
    QOpenGLFramebufferObjectFormat format;
    format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
    format.setMipmap(true);
    format.setSamples(4);
    format.setTextureTarget(GL_TEXTURE_2D);
    format.setInternalTextureFormat(GL_RGBA32F_ARB);

        //Create the FBO
        m_lpFBO = new QOpenGLFramebufferObject(vp[2], vp[3], format);
        m_lpFBOSurface = new QGLFramebufferObjectSurface(m_lpFBO);
    }
    
    QRect rc(0, 0, vp[2], vp[3]);
    QGLSubsurface sub(lpPainter->currentSurface(), rc);
    
    
    m_lpFBO->bind();
    sub.setFramebufferObject(m_lpFBO);
    lpPainter->pushSurface(&sub);
    
    //Draw as usual
    .
    . 
    .
    
    lpPainter->popSurface();
    
    
    //Now Copy
    QOpenGLFramebufferObject::blitFramebuffer(lpPainter->currentSurface()->framebufferObject(), rc, m_lpFBO, rc);
    

    @

    I am using Qt5 alpha and my development system is a Macbook pro with AMD 6600 GPU.

    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