如何将几何体着色器与CgFX一起使用?实际上,如何在"技术"中指定几何体着色器?
列表如下,顶点着色器和片段着色器编译良好。但在我将'GeometryProgram'
添加到'technique'
之后,"NVIDIA FX Composer 2.5"会触发'error C3001 no program defined'
。
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();
}
}
已解决。'glslg'
配置文件出现问题,将其更改为'gp4gp'
可修复此问题。