QVertexArrayObject / vao GL_INVALID_OPERATION



  • 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 ?



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.