0

I'm trying to write a Tessellation shader. However, I first want to make sure that the pipeline is working on my computer, so I wrote some really basic tessellation code.

However, when I try to run it, I keep getting a linker error saying my tessellation evaluation shader is not compiled. Does anyone know what this means or if the code below looks wrong?

tessellation.vert

#version 400

layout (location = 0 ) in vec2 in_position;
layout (location = 1 ) in vec4 in_color;

void main()
{
    gl_Position = vec4(in_position, 0.0, 1.0);
}

tessellation.tcs

#version 400

layout( vertices = 2 ) out;


void main()
{
    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;

    gl_TessLevelOuter[0] = float(2.0);
    gl_TessLevelOuter[1] = float(2.0);
}

tessellation.tes

#version 400

layout( isolines ) in;

void main()
{
    float u = gl_TessCoord.x;

    vec3 p0 = gl_in[0].gl_Position.xyz;
    vec3 p1 = vec3(0.5, gl_in[0].gl_Position.y, 0.0);
    vec3 p2 = vec3(0.5, gl_in[1].gl_Position.y, 0.0);
    vec3 p3 = gl_in[1].gl_Position.xyz;

    float u1 = (1.0 - u);
    float u2 = u * u;

    // Bernstein polynomials
    float b3 = u2 * u;
    float b2 = 3.0 * u2 * u1;
    float b1 = 3.0 * u * u1 * u1;
    float b0 = u1 * u1 * u1;

    // Cubic Bezier interpolation
    vec3 p = p0 * b0 + p1 * b1 + p2 * b2 + p3 * b3;

    gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(p, 1.0);
}

tessellation.frag

#version 400

layout ( location = 0 ) out vec4 FragColor;

void main()
{
  FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
Gargob
  • 251
  • 4
  • 14
  • 2
    Where is your client side code?Have you compiled all the shaders in the pipeline ?(Vert , frag , tess) – Michael IV May 28 '13 at 18:53
  • Yeah, the client side compiles it. Here's sample ` std::vector tessControlSource = readSource(path + ".tcs"); source[0] = &tessControlSource.front(); length = tessControlSource.size()-1; _tessControlShaderID = glCreateShader(GL_TESS_CONTROL_SHADER); glShaderSource(_tessControlShaderID, 1, source, &length); glCompileShader(_tessControlShaderID); glGetShaderiv(_tessControlShaderID, GL_COMPILE_STATUS, &tesscCompileStatus);` – Gargob May 29 '13 at 00:46

0 Answers0