Sorry for not replying before, I'm at the college hostel and I came home due to a lot of strikes today.
Thanks but I'm still unclear on what the glLinkProgram function does. The glAttachShader function attaches the shaders to the program so what does linking the program do? Also this may be a stupid question but when you say shader object do you mean shader? Are they the same thing?
Before writing about those functions, I want to say how C programs get created (Just to get the term LINKING). There, linking means that the generated object code is (in some compilers) linked
to a stub (format the OS can understand) which is the executable file we see after compilation. This is the same concept here,
links the program into an executable that the GPU can run. Before linking the program, we attach the shaders to the program using the
program. This function attaches the shaders in an order that first the vertex shader is attached and then the fragment shader is attached, no matter what the order we used in our source code.
Then at the time of executing, the GPU passes the program passes the vertex data to the vertex shader.
(vertex_data) --> (vertex_shader)
The generated pixels are passed to the fragment shader.
(pixels) --> (fragment_shader)
Those pixels will be then transformed to the screen coordinates and displayed on the screen. This is just a basic view of the SHADERS and you can get more info on that topic here