Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Opengl Tessellation Not Working no errors

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Joel_Wateroworth   Members   

111
Like
0Likes
Like

Posted 27 May 2014 - 03:40 AM

This script is written in haskell with an almost one to one mapping of the openglibrary

 

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);
}


#2 Joel_Wateroworth   Members   

111
Like
0Likes
Like

Posted 08 June 2014 - 02:26 AM

I solved the colour of triangle was the same as the background rather then the colour of the fragment shader.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.