Vertex Array Object question
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:
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 32, BUFFER_OFFSET(0));
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 32, BUFFER_OFFSET(12));
glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 32, BUFFER_OFFSET(24));
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
glBindTexture ( GL_TEXTURE_2D, texture ) ;
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?
Tags for this Thread