Search code examples
openglvbovao

Swizzling Vertex Arrays, Vertex Buffer Objects and Shaders


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?

Solution

  • 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)