|
|
在c++中使用shader,使用vs2005,编译shader,
效果文件如下:
float4 PS() : COLOR {
float color1= float3(0.45f, 0.65f, 1.0f);
return float4(0.45f, 0.65f, 1.0f,0.5f);
}
technique TShader {
pass P0 {
// States
AlphablendEnable = true;
SrcBlend = SrcAlpha;
DestBlend = InvSrcAlpha;
AlphaTestEnable = false;
// Compile Shaders
PixelShader = compile ps_2_0 PS();
}
}
如果写成这样子,可以渲染。
但是如果写成下面这样子:
float color1= float3(0.45f, 0.65f, 1.0f);
float4 PS() : COLOR {
return float4(0.45f, 0.65f, 1.0f,0.5f);
}
technique TShader {
pass P0 {
// States
AlphablendEnable = true;
SrcBlend = SrcAlpha;
DestBlend = InvSrcAlpha;
AlphaTestEnable = false;
// Compile Shaders
PixelShader = compile ps_2_0 PS();
}
}
使用tv3d6.5进行编译,编译可以通过,但是渲染时出错,为那个mesh指定的该shader,那么这个mesh.render就会出错。
很恶心的一个问题,上官网也问过了,只有一个人回复。
那位了解阿? [em7] |
|