如果我使用 VAO,是否需要调用 glEnableVertexAttribArray?

Do I need to call glEnableVertexAttribArray if I use VAOs?

我知道 VAO 可以存储 VBO 的绑定和索引 VBO(GL_ARRAY_BUFFERGL_ELEMENT_ARRAY_BUFFER),但现在我有一个问题:

void render()
{
    ..Set up textures, uniforms..

    glBindVertexArray(vaoId)); // This also binds VBOs and indices VBOs 
    automatically (if it was properly set up)

    glEnableVertexAttribArray(0); // Do I need this?
    glEnableVertexAttribArray(1); // Do I need this?
    glEnableVertexAttribArray(2); // Do I need this?

    glDrawElements(GL_TRIANGLES, indices_N, GL_UNSIGNED_BYTE, 0);

    .. cleanup..
}

即使我已经正确绑定了 VAO,我还需要调用 glEnableVertexAttribArray 吗?

这不是必须的。您应该已经在 VAO 设置期间调用了 glEnableVertexAttribArray,以便在绑定 VAO 时自动启用它们。