render the same triangle, but this time use interleaved
attributes are often more convenient.Passing the data to the GPU
void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalised, GLsizei stride, const GLvoid* pointer)
where the vertex attributes (positions, colours) are located in the array.
- The first vertex position is at 0 bytes
in the array. After this position, we
must skip stride
bytes to get to the next position.
- The first colour position is at sizeof(glm::vec3)bytes in the array. After this colour,
skip stride bytes to
get to the next colour.