1. Vertex Attributes----glVertexAttrib*(location, data): 往VS的 layout (location = x) 里灌数据
2. Intetface block:
out VS_OUT // block name
{
vec4 color;
} vs_out; // instance name
Interface blocks are matched between stages using the block name (VS_OUT in this case), but are referenced in shaders using the instance name.
Interface block只能用于shader与shader之间传递,不能用于进VS和出FS。
3. Tessellation Control Shader,TCS(per patch)
进出VS的position是控制点。
3.1 glPatchParameteri(GL_PATCH_VERTICES, n)设置n个控制点构成一个patch。n也是TCS中gl_in[]和gl_out[]的size。这两个数组的index是gl_InvocationID。
3.2.1 TCS指定每个patch的输出控制点个数,使用layout (vertices = m) out。通常和n一致,可能会通过其他算法得到不同的m。
输出:gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position
3.2.2 TCS also指定每个patch的tessellation level。内部gl_TessLevelInner(空间上划分行、列),外部gl_TessLevelOuter(边缘划分)。
3.3 TPG(tessellation primitive generator) (fixed)将输入的patch进行计算,输出新的相关数据(重心坐标等)
3.4 TES(tessellation evaluation shader) per (new)control point,可以根据其他控制点计算本点的gl_position。