Sending data to a shader using vertex attributes and vertex buffer objects
The vertex shader is invoked once per vertex. Its main job is to process the data associated with the vertex, and pass it (and possibly other information) along to the next stage of the pipeline. In order to give our vertex shader something to work with, we must have some way of providing (per-vertex) input to the shader. Typically, this includes the vertex position, normal vector, and texture coordinates (among other things). In earlier versions of OpenGL (prior to 3.0), each piece of vertex information had a specific channel in the pipeline. It was provided to the shaders using functions such as glVertex
, glTexCoord
, and glNormal
 (or within client vertex arrays using glVertexPointer
, glTexCoordPointer
, or glNormalPointer
). The shader would then access these values via built-in variables such as gl_Vertex
 and gl_Normal
. This functionality was deprecated in OpenGL 3.0 and later removed. Instead, vertex information...