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. Integrating custom OpenGL with QQuickFramebufferObject

Integrating custom OpenGL with QQuickFramebufferObject

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qquickframebuff
1 Posts 1 Posters 479 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.
  • Tom assoT Offline
    Tom assoT Offline
    Tom asso
    wrote on last edited by Tom asso
    #1

    I’d like to integrate my “custom” OpenGL drawing into QML via the QQuickFrameBufferObject approach described here. But I don't understand what Renderer::createFrameBufferObject() is supposed to return, given my current renderer. My custom renderer already maintains a VAO and three FBOs for vertices/colors, normals, and triangle-drawing indices:

    /// Vertex Array Object, holds all information to render surfac
    QOpenGLVertexArrayObject *m_vao;
    
    /// Vertex buffer object holds surface vertex positions and colors
    QOpenGLBuffer *m_positionColorBuffer;
    
    /// Vertex buffer object holds surface normal vectors
    QOpenGLBuffer *m_normalBuffer;
    
    /// Index buffer object holds indices for triangle strips
    QOpenGLBuffer *m_indicesBuffer;
    

    My renderer initializes these:

    m_vao->create();
    m_vao->bind();
    m_positionColorBuffer->create();
    m_positionColorBuffer->bind();
    m_positionColorBuffer->allocate(position-colors data here);
    
    m_normalBuffer->create();
    m_normalBuffer->bind();
    m_normalBuffer->allocate(normal vectors here);
    
    m_indicesBuffer->create();
    m_indicesBuffer->bind();
    m_indicesBuffer->allocate(index-drawing list here);
    // compile shaders, set attribute buffers, etc.
    
    

    My renderer's render method does this:

    m_vao->bind();
    glDrawElements(GL_TRIANGLES, m_indicesCount, GL_UNSIGNED_INT, 0)
    m_vao->release();
    

    But the example shows return of a single QOpenGLFrameBufferObject:

    class FbItemRenderer : public QQuickFramebufferObject::Renderer
    {
        QOpenGLFramebufferObject *createFramebufferObject(const QSize &size)
        {
            QOpenGLFramebufferObjectFormat format;
            format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
            // optionally enable multisampling by doing format.setSamples(4);
            return new QOpenGLFramebufferObject(size, format);
        }
    

    So in my renderer's case, what should createFrameBufferObject() return?
    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