<div>Hi everyone,</div> <div> Recently, I have been working on shaders in VTK. I use vtkProperty::LoadMaterial() to load the xml file successfully. But an error comes out while compiling the code. </div> <div>It says:</div> <div><FONT color=#0000ff>ERROR: In ..\..\VTK\Rendering\vtkCgShader.cxx, line 303<BR>vtkCgShader (032BB718): CG ERROR : The compile returned an error.</FONT></div> <div><FONT color=#0000ff>ERROR: In ..\..\VTK\Rendering\vtkCgShader.cxx, line 306<BR>vtkCgShader (032BB718): (51) : error C0000: syntax error, unexpected $undefined at token "<undefined>"<BR>(51) : error C0501: type name expected at token "<undefined>"</FONT></div> <div><BR><FONT color=#0000ff>ERROR: In ..\..\VTK\Rendering\vtkCgShader.cxx, line 265<BR>vtkCgShader (032BB718): Failed to create Cg program</FONT>. </div> <div> </div> <div>I don't know why and want your help. Thanks.</div> <div> </div> <div>My shader code is:</div> <div>vertex shader:</div>
<div><FONT color=#0080ff>struct C2E1v_Output {<BR> float4 position : POSITION;<BR> float4 color : COLOR;<BR>};</FONT></div> <div><FONT color=#0080ff>C2E1v_Output main(uniform float2 position : POSITION)<BR>{<BR> C2E1v_Output OUT;</FONT></div> <div><FONT color=#0080ff> OUT.position = float4(position, 0, 1);<BR> OUT.color = float4(0, 1, 0, 1); // RGBA green</FONT></div> <div><FONT color=#0080ff> return OUT; <BR>}</FONT><BR></div> <div>fragment shader:</div> <div><FONT color=#0080ff>struct C2E2f_Output {<BR> float4 color : COLOR;<BR>};</FONT></div> <div><FONT color=#0080ff>C2E2f_Output main(uniform float4 color : COLOR)<BR>{<BR> C2E2f_Output OUT;<BR> OUT.color = color;<BR> return OUT;<BR>}</FONT></div> <div><FONT color=#0080ff></FONT> </div> <div><FONT color=#0080ff>xml file is:</FONT></div> <div><FONT color=#0080ff><?xml version="1.0"
encoding="UTF-8"?><BR><Material name="Mat1" NumberOfProperties="1" NumberOfVertexShaders="1" NumberOfFragmentShaders="1">></FONT></div> <div><FONT color=#0080ff> <Shader scope="Vertex" name="Vertex" location="Vertex.cg" language="Cg" entry="main" args="-DVERTEX_PROGRAM"><BR> </Shader></FONT></div> <div><FONT color=#0080ff> <Shader scope="Fragment" name="TestCgStructureFrag" location="StructureFragmentTest.cg" language="Cg" entry="fragment_program" args="-DFRAGMENT_PROGRAM"><BR> </Shader></FONT></div> <div><FONT color=#0080ff></Material><BR></FONT>It's very simple.</div> <div> </div> <div>I hope you guys can help me.</div> <div><FONT color=#0080ff><FONT color=#000000>Thanks again.</FONT></div></FONT><p> 
<hr size=1><a href="http://cn.mail.yahoo.com/gc/index.html?entry=5&souce=mail_mailletter_tagline">ÑÅ»¢ÓÊÏä´«µÝÐÂÄê×£¸££¬¸öÐԺؿ¨ËÍÇ×Åó£¡</a>