It\'s not obvious from the documentation when glVertexAttribPointer should be called. It looks like it\'s part of VBO initialisation, but I notice example code
The association of buffer, generic vertex attribute and shader attribute variable are quite subtle. glVertexAttribPointer establishes this association. See OpenGL-Terminology for a detailed explanation.
Also, the link OpenGL-VBO,shader,VAO shows a working example with the necessary sequence of API calls.