doug65536
10-03-2011, 04:48 PM
I am implementing an instanced rendering system in my engine.
I use VAO's in my entity render code to bind the vertex buffer and element buffer for each different model.
My instancing code uses GL_ARB_instanced_arrays to setup a mat4 attribute. There is a VBO that I populate with an array of transformation matrices for each instance. I use glVertexAttribDivisorARB to make the attribute "become" each instance's transformation matrix as it iterates through the VBO of matrices in the glDrawElementsInstancedARB call.
So here's the question:
If I bind the matrix array VBO, then bind the model's vertex/element VAO after, would the matrix VBO still be bound, or would the VAO's bindings override (and unbind) the binding of the matrix array VBO.
I want to bind the matrix array before the VAO because I don't want the matrix array to become a part of the model's VAO. I am guessing that if I bind and unbind the matrix VBO while the VAO is bound, it would add significant overhead by modifying the VAO unnecessarily.
Thanks!
I use VAO's in my entity render code to bind the vertex buffer and element buffer for each different model.
My instancing code uses GL_ARB_instanced_arrays to setup a mat4 attribute. There is a VBO that I populate with an array of transformation matrices for each instance. I use glVertexAttribDivisorARB to make the attribute "become" each instance's transformation matrix as it iterates through the VBO of matrices in the glDrawElementsInstancedARB call.
So here's the question:
If I bind the matrix array VBO, then bind the model's vertex/element VAO after, would the matrix VBO still be bound, or would the VAO's bindings override (and unbind) the binding of the matrix array VBO.
I want to bind the matrix array before the VAO because I don't want the matrix array to become a part of the model's VAO. I am guessing that if I bind and unbind the matrix VBO while the VAO is bound, it would add significant overhead by modifying the VAO unnecessarily.
Thanks!