I have been battling this for hours. Scoured the internet and past forums posts but nothing I have found or tried has helped so far. I am just trying to get a very minimal working example of a tessellation shader running, but am having no luck.
I am in OpenGL 4.5 on Windows, C++ in VS. I use SFML, GLEW and GLM libraries.
I have no GL errors, no shader compile errors, no shader linker errors in my log. If I swap the shader (game.GL.shaderTess) for just a standard one with only vertex and fragment and change GL_PATCHES to GL_TRIANGLES it works as expected.
I imagine there is probably some simple mistake in there somewhere but I can figure out what it is for the life of me.
Draw Code
glUseProgram(game.GL.shaderTess);
glUniformMatrix4fv(game.GL.unifModelViewMatrixQuad, 1, GL_FALSE, glm::value_ptr(modelViewMatrix));
glBindVertexArray(game.GL.quadVertexArray);
glBindBuffer(GL_ARRAY_BUFFER, game.GL.quadPositionBuffer);
glBufferSubData(GL_ARRAY_BUFFER, 0, game.GL.SIZE_OF_QUAD_VERTEX_ARRAY, game.GL.quadVertices);
glBufferSubData(GL_ARRAY_BUFFER, game.GL.SIZE_OF_QUAD_VERTEX_ARRAY, game.GL.SIZE_OF_QUAD_VERTEX_ARRAY, game.GL.quadColor);
glPatchParameteri(GL_PATCH_VERTICES, 3);
glDrawArrays(GL_PATCHES, 0, game.GL.NUMBER_OF_QUAD_VERTEX_COORDINATES);
Vertex Shader
#version 430 core
in vec3 position;
in vec3 color;
out vec3 colorFS;
uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
void main()
{
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0f);
colorFS = color;
}
Tessellation Control Shader
#version 430 core
layout (vertices = 3) out;
void main()
{
gl_TessLevelInner[0] = 3.0;
gl_TessLevelOuter[0] = 3.0;
gl_TessLevelOuter[1] = 3.0;
gl_TessLevelOuter[2] = 3.0;
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
}
Tessellation Evaluation Shader
#version 430 core
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);
}
Fragment Shader
#version 430
in vec3 colorFS;
out vec4 FragColor;
void main()
{
FragColor = vec4(1.0,1.0,1.0,1.0);
}