When I try to compile Tesselation Control Shader and Evaluation Shader, I get the syntax errors. GLSL code exactly the same with tutorial code, which I use, except version of core.
GLSL code:
//Control shader
#version 400 core
layout ( vertices = 3 ) out;
void main(void)
{
if (gl_InvocationId == 0)
{
gl_TessLevelInner[0] = 5.0;
gl_TessLevelOuter[0] = 5.0;
gl_TessLevelOuter[1] = 5.0;
gl_TessLevelOuter[2] = 5.0;
}
gl_out[gl_InvocationId].gl_Position =
gl_in[gl_InvocationId].gl_Position;
}
//Evaluation shader
#version 400 core
layout (triangles, equal_spacing, cw) in;
void main(void)
{
gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position +
gl_TessCoord.y * gl_in[1].gl_Position +
gl_TessCoord.z * gl_in[2].gl_Position);
}
Create functions:
tesselation_control_shader = GL.CreateShader(ShaderType.TessControlShader);
tesselation_evaluation_shader = GL.CreateShader(ShaderType.TessEvaluationShader);
Error messages after compile:
//Control shader
WARNING: 1:1: 'layout' : symbol is deprecated in current GLSL version
ERROR: 1:1: 'vertices' : syntax error syntax error
//Evaluation shader
WARNING: 1:1: 'layout' : symbol is deprecated in current GLSL version
WARNING: 1:1: 'triangles' : symbol is deprecated in current GLSL version
WARNING: 1:1: 'equal_spacing' : symbol is deprecated in current GLSL version
WARNING: 1:1: 'cw' : symbol is deprecated in current GLSL version
ERROR: 4:1: 'gl_Position' : undeclared identifier
ERROR: 4:1: 'gl_TessCoord' : undeclared identifier
I don't know what wrong with this.