Well, it may sound harsh but try to think before you ask a question.
Last time when you was asking about the game design implementations of shaders we answered your question: They’re used for everything.
And yes, “everything” includes everything from a simple cube to real time shadows and extreme lighting effects.
You can ask for examples but the answer is that they’re everywhere. I’ve told you that the vertex shader is used for vertex position calculations and passing data to fragment shader, while the fragment shader tells OpenGL the color of the actual fragment it runs on.
glBindVertexArray(glGenVertexArrays()) simply binds an empty vertex array object, as far as I know this has no effect on rendering whatsoever, and you definitely should not get an error if it’s missing (assuming that you do everything correctly). Also it’s a bad practice since you should always store your generated object’s id so later on you can delete it when you don’t need it anymore, freeing up space VRAM.
Mod: Actually now I remember what vertex array objects do. As explained above by Danny02 they save the vertex attribute modifications and buffer bindings so if you use them all you have to do on rendering is to just bind the vertex array object and it’ll set all the buffers and vertex attribute pointers for you again so all you have to do is just render using glDrawArrays(…) or glDrawElements(…).
The glVertexAttribPointer(…) in your example tells OpenGL that the data should be sent to attribute array 0 (so basically to location 0), that the attribute has 3 components (so it will become a vec3 in the shader), the type is float, the stride between the attribute in the buffer is 3<<2 (I don’t really get it why do you do this, see my explanation on this parameter below) and that the data starts right on the first byte of the buffer.
You say that you understand every parameter in glVertexAttribPointer(…) and then you ask how does data gets passed to the shader, which clearly explains that you don’t understand what glVertexAttribPointer(…) does.
Using glVertexAttribPointer(…) you can tell OpenGL what data it should send to the shader in what format.
One really important fact is that the vertex attribute pointer will always send data from the currently bidden array buffer.
The parameters are already explained here but I will try to rephrase them for you:
index - The index of the vertex attribute array (you will also have to enable it using glEnableVertexAttribArray(index))
size - The number of components that you’re going to pass. Can be only 1, 2, 3 or 4 and OpenGL will automatically convert it to float (probably), vec2, vec3 or vec4.
normalized - If set to true OpenGL will normalize the value on access. Otherwise it should be set to false.
stride - The stride of the parameter IN BYTES. This is the most tricky value since not only the value is set in bytes but also you have to set the stride so that it will point from the first component to the next instance of this attribute. My explanation is probably crap because of my english skills but you should look it up once you start to use interleaved arrays (also remember that 1 float = 4 bytes). For now all you have to know that if you set it to 0 OpenGL will assume that the buffer is tightly packet and it can continuously read the data from it. TLDR: Set it to 0 for now, look it up later when you do more complex stuff.
offset - The offset before the attribute’s first appearance in the buffer specified IN BYTES. This one’s easier to explain than the stride: If your buffer looks like this [1, 2, 3, 4, 5, 6, …] and you want OpenGL to read the buffer from number 4 you set the offset to 12 because that equals 3x4 so it’ll skip the first 3 floats in the buffer. Also until you don’t fill up your buffer with other stuff or you don’t use interleaved arrays you shouldn’t really worry about this and just set this to 0.
Some information I wrote here might not be 100% correct theoretically because I’m a hobbyist and not a professional (even though I’m planning to be one soon ;D), however most of the stuff should be correct. I know OpenGL can be hard to learn but never give up and you’ll become good at it in no time.