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. QVertexArrayObject / vao GL_INVALID_OPERATION
Forum Update on Monday, May 27th 2025

QVertexArrayObject / vao GL_INVALID_OPERATION

Scheduled Pinned Locked Moved General and Desktop
openglvaoqvertexarrayobj
3 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.
  • D Offline
    D Offline
    djvi
    wrote on 22 Jul 2015, 09:53 last edited by djvi
    #1

    Hi,

    I am implementing a 3D software and I encounter a problem with the vao. Here is the error message I get :

    QOpenGLDebugMessage("APISource", 1282, "GL_INVALID_OPERATION error generated. VAO names must be generated with glGenVertexArrays before they can be bound or used.",

    I get this message when I try to set up a vao outside of initializeGL, here is the code I use :

    shaderProgram->bind();
    currentVbo=new QOpenGLBuffer();
    currentVbo->create();
    currentVbo->bind();
    currentVbo->setUsagePattern(QOpenGLBuffer::DynamicDraw);
    currentVbo->allocate(vertexVRAMArray , sizeof(VerticeVRAM)*nbVerticeInCurrentVbo);
    currentVao=new QOpenGLVertexArrayObject();
    currentVao->create();
    currentVao->bind();
    shaderProgram->enableAttributeArray("position");
    shaderProgram->enableAttributeArray("color");
    shaderProgram->enableAttributeArray("normal");
    shaderProgram->setAttributeBuffer("position", GL_FLOAT, VerticeVRAM::positionOffset(), VerticeVRAM::PositionTupleSize, VerticeVRAM::stride());
    shaderProgram->setAttributeBuffer("color", GL_FLOAT, VerticeVRAM::colorOffset(), VerticeVRAM::colorTupleSize, VerticeVRAM::stride());
    shaderProgram->setAttributeBuffer("normal", GL_FLOAT, VerticeVRAM::normalOffset(), VerticeVRAM::normalTupleSize, VerticeVRAM::stride());
    currentVao->release();
    currentVbo->release();
    shaderProgram->release();
    

    If I don't use vao it work perfectly, if I set up the vao during the initialization of the openglwidget, it work perfectly but if I create the vao after initializeGL I get the error message above.

    I may have misunderstood the use of vao :
    Is it possible to use one vao for multiple vbo ?
    What is the requirement when inistializing a vao ?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      djvi
      wrote on 27 Jul 2015, 14:17 last edited by
      #2

      Haven't solve the problem yet anyone have an idea ?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dariusz
        wrote on 24 Feb 2018, 22:30 last edited by Dariusz
        #3

        Did you ever manage to solve this? I got the same issue :/

        Solved, I had 2 context's somehow and that messed it all up on my end.

        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