When I add my tesselation control shader to my rendering program, the viewport gets black. Without the TSC the vertex and fragment shader work fine. I also checked for compile errors but no occurs.
Vertex shader:
#version 410 core layout (location = 0) in vec4 offset; layout (location = 1) in vec4 color; out VS_OUT { vec4 color; } vs_out; void main(void) { const vec4 vertices[3] = vec4[3] ( vec4( 0.25, -0.25, 0.5, 1.0), vec4(-0.25, -0.25, 0.5, 1.0), vec4( 0.25, 0.25, 0.5, 1.0) ); // Add "offset" to our hard-coded vertex position gl_Position = vertices[gl_VertexID] + offset; // Output the color from input attrib vs_out.color = color; } Tessellation control shader:
#version 410 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; } Tessellation evaluation shader:
#version 410 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); } Fragment shader:
#version 410 core in VS_OUT { vec4 color; } fs_in; out vec4 color; void main(void) { color = fs_in.color; } I forgot to check for shader linking errors. And this is what I get:
WARNING: Output of vertex shader '<out VS_OUT.color>' not read by tessellation control shader ERROR: Input of fragment shader '<in VS_OUT.color>' not written by tessellation evaluation shader How can I fix this?
GL_PATCHESprimitives. You need to do that when you use a TCS, and set the number of vertices per-patch as well. You will need a call like this:glPatchParameteri (GL_PATCH_VERTICES, N);somewhere.