CgFX几何着色器

时间:2012-09-11 09:04:29

标签: cg geometry-shader

如何在CgFX中使用几何着色器?实际上如何在'技术'中指定几何着色器?

列表如下,顶点和片段着色器编译得很好。但是,在我将'error C3001 no program defined'添加到'GeometryProgram'后,“NVIDIA FX Composer 2.5”会触发'technique'

float4x4 WorldITXf : WorldInverseTranspose;
float4x4 WorldViewProjXf : WorldViewProjection;
float4x4 WorldXf : World;

struct appdata
{
    float4 Position : POSITION;
    float4 Color    : COLOR0;
};

struct vertexOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR0;
};


TRIANGLE void gshader1(AttribArray<float4> pos : POSITION,
                      AttribArray<float4> col : COLOR0)
{
//    some code will be here;
}


vertexOutput vshader1(appdata IN)
{
    vertexOutput OUT;
    float4 Po = float4(IN.Position.xyz,1.0f);
    OUT.Position = mul(WorldViewProjXf, Po);

    OUT.Color = IN.Color;

    return OUT;
}

float4 fshader1(vertexOutput IN) : COLOR
{
    return  IN.Color;
}

technique Tec1 {
    pass p0 {
        GeometryProgram = compile glslg gshader1();
        VertexProgram = compile glslv vshader1();
        FragmentProgram = compile glslf fshader1();
    }
}

1 个答案:

答案 0 :(得分:1)

解决。 'glslg'个人资料有问题,将其更改为'gp4gp'会解决问题。