There are two distinct types of "shader" programs in OpenGL:
Vertex Shader (VS) ⇒ Tessellation Control Shader (TCS) ⇒ Tessellation Evaluation Shader (TES) ⇒ Geometry Shader (GS) ⇒ Fragment Shader (FS) |
Only the VS and FS are required. If a tessellation shader is used, both the TCS and TES are required. Between the VS and FS, there can be just TCS/TES, just GS, both, or neither. If both, they will always execute in the order shown above. The order is important because the output of one stage is the input to the next.
To support all these options, note that there is another ShaderIF constructor whose prototype is:
where ShaderIF::ShaderSpec is declared inside the ShaderIF class as:
struct ShaderSpec { std::string fName; GLenum sType; };
and where sType is one of: GL_VERTEX_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER, or GL_FRAGMENT_SHADER. You will see examples of the use of this constructor in the "Geometry Shaders" and "Tessellation Shaders" sections below.
We will discuss the various shaders and shader techniques in the following order: