Vertex Array Object question

Hello again,

I have a question about VAOs, how they work and what all they encapsulate. Like, you first create and bind a VAO, then make a bunch of calls to set the state, right? Like this:

glGenVertexArraysOES(1, &_vertexArray);
glBindVertexArrayOES(_vertexArray);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 32, BUFFER_OFFSET(0));
glEnableVertexAttribArray(GLKVertexAttribNormal);
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 32, BUFFER_OFFSET(12));
glEnableVertexAttribArray(GLKVertexAttribTexCoord0);
glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 32, BUFFER_OFFSET(24));
glBindVertexArrayOES(0);

Then later you can just bind the VAO and it magically restores all those settings right?

So my first question is, what if, while it is bound, you change one of those settings? Say I disable the normal attribute. Does that change become the new state of the VAO? Like, the next time I bind it, will the normal attribute be enabled like it was originally, or disabled?

Second question – do they store the active texture? Like, when I create and first bind my VAO, if I make these calls

    glActiveTexture(GL_TEXTURE0);
glBindTexture ( GL_TEXTURE_2D, texture ) ;
    glUniform1i(_textureUniform, 0);

Which of these if any are stored as part of the ‘state’? I am just unclear about what things are stored in the VAO and which things you need to do separately every time you change them.

Also, what about the current shader program? Is that part of a VAO or set separately?

Thanks!
Bob

All the vertex array attribute bindings end enables, yes. Thus “vertex array object”. And yes, if you modify the bindings while bound, it updates the VAO.

Second question – do they store the active texture?

No.