Hi all – The wiki artical on VAOs says the following:
Note: Changing the GL_ARRAY_BUFFER binding does not affect VAO state. This is different from the GL_ELEMENT_ARRAY_BUFFER binding, which is directly part of VAO state.
This seems to contradict the OpenGL spec, section 2.10, which reads:
The buffer objects that are to be used by the vertex stage of the GL are collected together to form a vertex array object.
Unlike the wiki, the spec makes no distinction about buffer bindings, implying all buffer objects related to vertex arrays are part of VAO state. Indeed the spec appears to be correct, as I verified with the following code:
glBindVertexArray( _vaoID );
if( _first )
{
_first = false;
glBindBuffer( GL_ARRAY_BUFFER, _bufID );
glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, stride, (const void*)0 );
glEnableVertexAttribArray( 0 );
glVertexAttribPointer( 1, 3, GL_FLOAT, GL_FALSE, stride, (const void*)( sizeof( GLfloat ) * 3 ) );
glEnableVertexAttribArray( 1 );
}
glDrawArrays( GL_TRIANGLE_STRIP, 0, 6 );
glBindVertexArray( 0 );
This code draws correctly on the first and subsequent frames, even though GL_ARRAY_BUFFER has different bindings on entry to this code block.
Can someone else confirm the wiki is incorrect? If so, let’s go in and correct it (I have never made a change to the wiki and don’t know what’s involved in that, but I’m willing to make the change if I can do so).