I am putting the 'finishing' touch on the shader tutorial (Well 'basic' tutorial is complete, but I want to shows alternatives when writing things). But, by simplifying things I am getting in to some issues. I am describing in the tutorial the template functionality through that little snippet:

<shader compiler="xmlshader" name="diffuse_cg">
   <technique priority="200">
   <pass>
<buffer source="texture coordinate 0" destination="texture coordinate 0" />
       <vp plugin="glcg" file="/this/diffuse_cg.cgvp" />
       <texture name="tex diffuse" destination="TexDiffuse" />
       <fp plugin="glcg">
           <cgfp>
<variablemap variable="mat hilitecolor" destination="hiliteColor" />
               <program>
                   <![CDATA[
struct vertex2fragment {
   float4 Hposition : POSITION;
   float2 TexCoord : TEXCOORD0;
};

float4 main (vertex2fragment IN,
        uniform sampler2D TexDiffuse,
        uniform float4    hiliteColor) : COLOR
{
_/*    <?if vars."mat hilitecolor"?>
       return tex2D (TexDiffuse, IN.TexCoord) + hiliteColor;
   <?else?>
       return tex2D (TexDiffuse, IN.TexCoord);
   <?endif?>*/_
}

]]>
               </program>
           </cgfp>
       </fp>
   </pass>
   </technique>
</shader>

And nothing happens (The fragment shaders does not get compiled), because I am guessing (not sure) that the <![CDATA[ ... ]]> protect from any intervention of the template expansion mechanism inside the Cg program. Am I right ? Then what would be a reasonable workaround ? Note that the 'cgvp' is used unchanged succesfully otherwise, so I know it is not the
culprit.

Best regards,

Sebastien.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Crystal-main mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to