c++ - OpenGL Tessellation won't render -


i starting work tessellation , have problems right in beginning. try render quad made of 2 triangles tessellation, nothing appears on screen. remove tessellation shaders , change gl_patches gl_trianglesagain, starts working again, without tessellation obviously.

so here code setup tessellation shaders:

glpatchparameteri(gl_patch_vertices, 3); shaderid = glcreateprogram(); {     vertex = graphicsutilities::loadshader("d:\\vert.glsl", gl_vertex_shader);     glattachshader(shaderid, vertex);       fragment = graphicsutilities::loadshader("d:\\frag.glsl", gl_fragment_shader);               glattachshader(shaderid, fragment);      tcs = graphicsutilities::loadshader("d:\\tcs.glsl", gl_tess_control_shader);     glattachshader(shaderid, tcs);      tes = graphicsutilities::loadshader("d:\\tes.glsl", gl_tess_evaluation_shader);     glattachshader(shaderid, tes); } gllinkprogram(shaderid); 

this vertex shader:

   #version 400  layout(location=0) in vec4 vertposition; layout(location=1) in vec2 vertuv; layout(location=2) in vec3 vertnormal;  void main(void){                 gl_position = vertposition;  } 

the tcs:

#version 400 layout (vertices = 3) out;  void main() {     gl_out[gl_invocationid].gl_position = gl_in[gl_invocationid].gl_position;      gl_tesslevelouter[0] = 3.0;     gl_tesslevelouter[1] = 3.0;     gl_tesslevelouter[2] = 3.0;     gl_tesslevelinner[0] = 3.0; } 

and tes:

#version 400 layout(triangles, equal_spacing, cw) in;  void main() {     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); } 

and how draw quad:

glpolygonmode( gl_front_and_back, gl_line ); gluseprogram(shaderid);  glbindvertexarray(quad->getvboid());  gldrawelements(gl_patches, 6, gl_unsigned_int, (glvoid*)0);  glbindvertexarray(0);  gluseprogram(0); glpolygonmode( gl_front_and_back, gl_fill ); 

i tried using in , out variables instead of gl_in/out, doesn't work either. tried without tcs. using apitrace errors, nothing. function loadshader() looks compile errors. cause problem? have no idea how debug thing further.


Comments