当我尝试编译Tesselation Control着色器和评估着色器时,我得到了语法错误。 GLSL代码与我使用的教程代码完全相同,除了核心版本。
GLSL代码:
//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);
}
创建功能:
tesselation_control_shader = GL.CreateShader(ShaderType.TessControlShader);
tesselation_evaluation_shader = GL.CreateShader(ShaderType.TessEvaluationShader);
编译后的错误消息:
//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
我不知道这有什么问题。