Hello I have been learning the basics of GLSL and have come across a problem.
I have tried a few different variations of code and the only time I have got it to work is if I disable the tessellation.
When I run this code nothing renders…
//SOURCE CODE FOR VERTEX SHADER
static const GLchar* vertShaderSource[] =
{
"#version 430 core
"
"layout (location = 0) in vec4 offset;
"
"layout (location = 1) in vec4 color;
"
"out vec4 vs_color;
"
"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));
"
"gl_Position = vertices[gl_VertexID] + offset;
"
"vs_color=color;
"
"}
"
};
//SOURCE FOR TESSALATION CONTROL SHADER
static const GLchar* TCSsource[] =
{
"#version 430 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;
"
"}
"
};
//SOURCE FOR THE TEESALATION CONTROL SHADER
static const GLchar* TEShaderSource[] =
{
"#version 430 core
"
"layout (triangles,equal_spacing,cw) in;
"
"in vec4 vs_color; /n"
"out vec4 tes_color;
"
"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);
"
"tes_color = vs_color;
"
"}
"
};
//SOURCE CODE FOR FRAGMENT SHADER
static const GLchar* fragShaderSource[] =
{
"#version 430 core
"
"
"
"in vec4 tes_color;"
"out vec4 color;
"
"
"
"void main(void)
"
"{
"
"color = tes_color;
"
"}
"
};