0

I have a basic understanding of Vertex Arrays, Vertex Buffer Objects and Shaders. However, I am not sure if I can reuse them or whether the association is bijective.

For example:

  • Can I use the same Vertex Buffer Object in different Vertex Arrays?
  • Can I use the same Vertex Array in different Shaders?

1 Answer 1

3

Yes you can :)

VBO - controls where your data is stored

VAO - controls layout and binding (you can have several VAO that points to the same VBO, but in different ordering)

Shaders - are responsible for doing something with the data, they can be used with different VAO/VBO combinations (but that combination must match attribute layout in the shader of course)

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. So when I want to use one VAO with multiple shaders, I only need to make sure that the attribute locations are the same? How do I switch the VBO for a VAO? Just by calling glBindBuffer after calling glBindVertexArray?
here is a good tutorial on usig VAO: ogldev.atspace.co.uk/www/tutorial32/tutorial32.html, but basically you can bind new VBO after you bound VAO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.