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. QOpenGLVertexArrayObject::create() fails inside a QQuickFramebufferObject::Renderer derived class

QOpenGLVertexArrayObject::create() fails inside a QQuickFramebufferObject::Renderer derived class

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.9k 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.
  • M Offline
    M Offline
    modeldancecontroller
    wrote on 9 Mar 2014, 15:15 last edited by
    #1

    I have a class derived from QQuickFramebufferObject::Renderer which I use to render to a QQuickFramebufferObject. My application has a QML based UI but needs OpenGL rendering.

    I have got this currently to use VAOs with VBOs :
    @// VAO
    mVAO = new QOpenGLVertexArrayObject();
    if (!mVAO->create()) {
    qDebug() << "ERROR: VAO creation failed";
    }
    mVAO->bind();

    // VBO
    mVBO = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
    if (!mVBO->create()) {
    qDebug() << "ERROR: VBO creation failed";
    }
    mVBO->setUsagePattern( QOpenGLBuffer::StreamDraw );
    mVBO->bind();
    mVBO->allocate( mVertices.constData(), mVertices.count() * 3 * sizeof( float ) );
    mProgram.enableAttributeArray(mVertexAttrLoc);
    mProgram.setAttributeBuffer(mVertexAttrLoc, GL_FLOAT, 0, 3 ); // uses the currently bound VBO

    // This is imp, we do not want any more state info recorded
    mVAO->release();@

    The mVAO->create() fails for some reason. Is there anyway to get more information from opengl about this error ?

    One other thing is I am using Qt 5.2 and a laptop with a dual video card and the nvidia optimus thingy. But I can see the program is executed by the nvidia card and not the onboard intel card. So it probably is not a hardware capabilities issue.

    The OpenGL version reported by qDebug() << "OpenGL version:" << QGLFormat::openGLVersionFlags();

    is OpenGL version: QFlags(0x800) which is QGLFormat::OpenGL_ES_Version_2_0

    Maybe the ES version is whats standard in laptops. I am guessing QOpenGLVertexArrayObject should work inside a QQuickFramebufferObject::Renderer class but maybe I need to try pure opengl instead ?

    I used this as a reference to write the code : http://www.kdab.com/opengl-in-qt-5-1-part-2/

    1 Reply Last reply
    0
    • A Offline
      A Offline
      agocs
      wrote on 10 Mar 2014, 08:43 last edited by
      #2

      That's perfectly normal. You are using OpenGL (ES? that's somehow doubtful) 2.0 without support for vertex array objects. create() returns false in this case, indicating that VAOs are not supported with the current context. This is fine, just continue without VAOs.

      To use the examples in the references blog series, you need to request a OpenGL 3.x or 4.x context.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        modeldancecontroller
        wrote on 10 Mar 2014, 18:07 last edited by
        #3

        Ok, how do I request one ? By the time my QQuickFramebufferObject::Renderer gets created, a FBO is already created and bound.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          agocs
          wrote on 12 Mar 2014, 11:30 last edited by
          #4

          Either stop relying on VAOs, i.e. set the vertex attributes every time (since mVAO->bind() will have no effect if VAOs are not supported) or do something like the following example (see lines starting from 159 and 204):

          https://qt.gitorious.org/qt/qtbase/source/c466f2ed464a06ac6427df6135d3e905011aa50e:examples/opengl/contextinfo/renderwindow.cpp

          1 Reply Last reply
          0

          1/4

          9 Mar 2014, 15:15

          • Login

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