1. Create shader Object Gluint glcreateshader (glenum type)
Creates a blank shader object and returns its handle, type Gl_vertex_shader or Gl_fragment_shader
2. Define shader Source code string
void Glshadersource (gluint shader,gluint nstrings,const glchar** source,glint *lenghs)
For example Glshadersource (*shader, sizeof (sources)/sizeof (*sources), sources, nullptr);
If lenghs is nullptr, the individual strings are assumed to end with NULL, and if lengths is not nullptr, it will point to an array containing the string lengths of each corresponding element of strings
3. Compile shader object void Glcompileshader (gluint shader)
4. Create a Program object Gluint Glcreateprogram (), returns a blank program object and returns its handle to which the program object can attach a shader object
5. Attaching Shader objects
void Glattachshader (gluint program,gluint shader)
You can attach a shader object to multiple program objects
6. linker void Gllinkprogram (gluintprogram)
The link operation assigns the position of the consistent variable and resolves the reference between the independently compiled shader objects. If you include Gl_vertex_shader, you create an executable program that will run on a programmable vertex processor, and if you include Gl_fragment_shader, you will create an executable that will run on the chip processor. To keep clean, a useful programming technique is to remove shader objects once they are attached to a program object and then delete them when they are successfully connected, but they are marked as no longer referenced as deleted.
7. Installer object as part of the current render state void Gluseprogram (gluintprogram)
This article from "Progress a little every day" blog, reproduced please contact the author!
OpenGL Learning notes-shader creation