If you want to study ready source code, i'm happy to show you few weeks ago rewritten shader classes from nxPascal
https://code.google.com/p/nxpascal/s...c/nxGL.pas#177
TShaderSource, TShaderProgram and TGLShader are responsible of creating, loading and using the shader with OpenGL with all imaginative ways possible. Also reporting errors and compile-errors that might come up.

Usage is simple (adding error reporting there's a full demo):
Code:
shader:=TGLShader.Create;
shader.AddDefault3D(true);
shader.Link;
shader.Enable;