O'Reilly logo
  • Musharraf Azeem thinks this is interesting:



Cover of OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition


It seems each VAO can be thought of as an ordered collection of N vertices. All vertices have K attributes, where K can be arbitrary chosen (ie. describe each vertex with as many attributes as you need. Typical attributes include position, colour, normal, texture Coordinate, material, and so on.)

How to specify the K attributes values of our N vertices? Two steps:
1) Specify each of the K attributes in our vertex shader as input variables.
2) For each attribute i / shader input variable, use glVertexAttributePointer to provide i values of all vertices. Essentially mapping shader input variable i to a buffer containing values [V1.i, V2.i, .. VN.i]