I tried to use Cg shaders in my game but I get a compilation error during execution:
Code: Select all
GLSL shader failed to compile
Vertex shader failed to compile with the following errors:
ERROR: 0:2: error(#132) Syntax error: 'float4' parse error
ERROR: error(#273) 1 compilation errors. No code generated
Here are portions of my code, maybe some of you will help me:
Game.cpp:
Code: Select all
// Cg Test shader
CgTest = gpuManager->addHighLevelShaderMaterialFromFiles(
"resource/Shader/cgtest.vertex.cg", "mainVS", video::EVST_VS_2_0,
"resource/Shader/cgtest.pixel.cg", "mainPS", video::EPST_PS_2_0,
0, video::EMT_SOLID, 0, video::EGSL_CG
);
Code: Select all
Node->setMaterialType((video::E_MATERIAL_TYPE)Game::Shaders.CgTest);
Code: Select all
struct vertex_Output {
float4 position : POSITION;
float4 color : COLOR;
};
vertex_Output mainVS(float2 position : POSITION)
{
vertex_Output OUT;
OUT.position = float4(position, 0, 1);
OUT.color = float4(0, 1, 0, 1);
return OUT;
}