Hi all,

I am trying to get tesselation shader to work (OpenSG 2).
I got rid of all errors but still nothing to see..

I set them up like that:


    vProgram = ShaderProgram::createVertexShader  ();
    fProgram = ShaderProgram::createFragmentShader();
    gProgram = ShaderProgram::createGeometryShader();
    tcProgram = ShaderProgram::create();
    tcProgram->setShaderType(GL_TESS_CONTROL_SHADER);
    teProgram = ShaderProgram::create();
    teProgram->setShaderType(GL_TESS_EVALUATION_SHADER);

    shaderChunk->addShader(md->vProgram);
    shaderChunk->addShader(md->fProgram);
    shaderChunk->addShader(md->gProgram);
    shaderChunk->addShader(md->tcProgram);
    shaderChunk->addShader(md->teProgram);

    vProgram->setProgram(vp.c_str());
    fProgram->setProgram(fp.c_str());
    pProgram->setProgram(gp.c_str());
    tcProgram->setProgram(tcp.c_str());
    teProgram->setProgram(tep.c_str());

vertex shader:
#version 120

attribute vec4 osg_Vertex;
attribute vec2 osg_MultiTexCoord0;

void main(void) {
gl_Position = osg_Vertex;
}


fragment shader:
#version 120

void main( void ) {
gl_FragColor = vec4(1.0);
}


geometry shader:
#version 400 compatibility

#extension GL_EXT_gpu_shader4: enable
#extension GL_EXT_geometry_shader4: enable

layout(triangles) in;
layout(triangle_strip, max_vertices = 200) out;

void main(void) {
  gl_Position = gl_ProjectionMatrix * vec4(gl_PositionIn[0].xyz, 1.);
    EmitVertex();
  gl_Position = gl_ProjectionMatrix * vec4(gl_PositionIn[1].xyz, 1.);
    EmitVertex();
  gl_Position = gl_ProjectionMatrix * vec4(gl_PositionIn[2].xyz, 1.);
    EmitVertex();
    EndPrimitive();
}


tess control shader:
#version 400
#extension GL_ARB_tessellation_shader : enable

layout(vertices = 16) out;
out vec3 tcPosition[];

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

    if (gl_InvocationID == 0) {
        gl_TessLevelInner[0] = 4;
        gl_TessLevelInner[1] = 4;

        gl_TessLevelOuter[0] = 4;
        gl_TessLevelOuter[1] = 4;
        gl_TessLevelOuter[2] = 4;
        gl_TessLevelOuter[3] = 4;
    }
}

tess eval shader:
#version 400
#extension GL_ARB_tessellation_shader : enable

layout( quads ) in;
in vec3 tcPosition[];

void main() {
    float u = gl_TessCoord.x;
    float v = gl_TessCoord.y;
    vec3 a = mix(tcPosition[0], tcPosition[3], u);
    vec3 b = mix(tcPosition[12], tcPosition[15], u);
    vec3 tePosition = mix(a, b, v);
    gl_Position = vec4(tePosition, 1);
}




I tried debugging with gDEBugger,
compiling the program gives the following warnings and errors:

------ Build Started: GL Context 1 ------
Compiling...
Linking...
Program 1
     Tessellation control info
     -------------------------
     (0) : warning C6029: No output primitive type
     (0) : warning C7543: geometry shaders require #extension
GL_EXT_geometry_shader4
     Tessellation evaluation info
     ----------------------------
     (0) : warning C7543: geometry shaders require #extension
GL_EXT_geometry_shader4
     (0) : error C7005: no tessellation primitive mode specified
----------------- Done -----------------
   Compile: 3 Succeeded, 0 Failed
   Link: Failed
   Validate: Not Executed

Strange is that gDEBugger only sees the vertex fragment and geometry
shader, not the two tesselation shader..

any hints on what I am doing wrong?


Best regards,
Victor
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to