0

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.

IvanDamm
  • 1
  • 1
  • Does your hardware actually support OpenGL 4.0? – Nicol Bolas Mar 05 '16 at 14:39
  • Nvidia GeForce GT 540M, driver is latest, it should to support. I tried to compile Vertex and Fragment shaders with "400 core", and all is fine there. – IvanDamm Mar 05 '16 at 15:30
  • @IvanDamm I have the same GPU and I'm running OpenGL 4.5 with tessellation shaders. If you copy pasted, try to write from scratch as sometimes there are non-graphical characters in the way. Make sure you use the proper enums (ie. `glCreateShader( GL_TESS_CONTROL_SHADER )`, etc). Otherwise I can't tell what's wrong. – aslg Mar 05 '16 at 17:16

0 Answers0