This script is written in haskell with an almost one to one mapping of the opengl library.
As you can see from the title my script is not working. Before I added the tessellation shaders it was working. I have had no errors.
This is game loop and pre Loop
preMainLoop :: G.Window -> IO ()
preMainLoop window = do
p <- shaderProgram [("vert.vs",gl_VERTEX_SHADER),("frag.fs",gl_FRAGMENT_SHADER)
,("testCon.tcs",gl_TESS_CONTROL_SHADER),("testEva.tes",gl_TESS_EVALUATION_SHADER)]
myVAO <- genVertexArrayObject
mainLoop window p
mainLoop window p = do
action <- (G.windowShouldClose window)
unless action $ do
printError
Just t <- G.getTime
clearBufferfv gl_COLOR 0 (0.0, 0.0, 0.0, 1)
-----------------------------------------------------------------------------
glUseProgram p
vertexAttrib4fv 0 ((sin (realToFrac t)) * 0.5
,(sin (realToFrac t)) * 0.6
, 0.0, 0.0)
vertexAttrib4fv 1 ((tan (realToFrac t)) * 0.5
,(tan (realToFrac t)) * 0.6
, 0.0, 0.0)
glPolygonMode gl_FRONT_AND_BACK gl_LINE
-- glPatchParameteri gl_PATCH_VERTICES 3
glDrawArrays gl_PATCHES 0 3
-----------------------------------------------------------------------------
G.swapBuffers window
G.pollEvents
mainLoop window p
This the vertex shader
#version 430 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));
gl_Position = vertices[gl_VertexID] + offset;
vs_out.color = color;
}
This is the fragment shader
#version 430 core
in VS_OUT
{
vec4 color;
} fs_in;
out vec4 color;
void main (void)
{
color = fs_in.color;
}
This is the tessellation control shader
#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;
}
This is the tessellation evaluation shader
#version 430 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);
}