-- beziert.vertex
#version 400 core
layout(location = VERTEX_BINDINGS_POSITION) in vec3 Position;
void main()
{
gl_Position = vec4(Position,1);
}
-- beziert.tcs
#version 400 core
layout( vertices = 4 ) out;
void main( )
{
gl_out[ gl_InvocationID ].gl_Position = gl_in[ gl_InvocationID ].gl_Position;
gl_TessLevelInner[0] = 10;
gl_TessLevelInner[1] = 10;
gl_TessLevelOuter[0] = 10;
gl_TessLevelOuter[1] = 10;
gl_TessLevelOuter[2] = 10;
gl_TessLevelOuter[3] = 10;
}
-- beziert.tes
#version 400 core
uniform mat4 u_CameraModelView ;
uniform mat4 u_CameraProjection ;
uniform mat4 u_ModelMatrix;
layout( isolines, equal_spacing) in;
void main( )
{
vec4 p0 = gl_in[0].gl_Position;
vec4 p1 = gl_in[1].gl_Position;
vec4 p2 = gl_in[2].gl_Position;
vec4 p3 = gl_in[3].gl_Position;
float u = gl_TessCoord.x;
// the basis functions:
float b0 = (1.-u) * (1.-u) * (1.-u);
float b1 = 3. * u * (1.-u) * (1.-u);
float b2 = 3. * u * u * (1.-u);
float b3 = u * u * u;
vec4 pos = b0*p0 + b1*p1 + b2*p2 + b3*p3;
gl_Position = u_CameraProjection * u_CameraModelView * u_ModelMatrix * pos;
}