如何在 CgFX 中使用几何着色器?实际上如何在“技术”中指定几何着色器?
清单如下,顶点和片段着色器编译得很好。但是“NVIDIA FX Composer 2.5”'error C3001 no program defined'
在我添加'GeometryProgram'
到'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();
}
}