Differences between HLSL and cgFX
From Virtools Wiki
The aim of this page is to convert a HLSL shader in cgFX and vice versa by showing some differences.
FX : vsOut.Pos = mul( float4(pos,1) , Wvp );
cgFX : vsOut.Pos = mul( Wvp, float4(pos,1) );
with :
float4x4 Wvp : WORLDVIEWPROJECTION; float4 Pos : POSITION;
FX : VertexShader = compile vs_1_1 myVS();
FX : PixelShader = compile ps_2_0 myPS();
cgFX : VertexProgram = compile arbvp1 myVS();
cgFX : FragmentProgram = compile arbfp1 myPS();
FX : Texture[0] = NULL;
cgFX : Texture2DEnable[0] = false;
FX : LightEnable[0] = false;
cgFX : LightingEnable = false;
cgFX : LightEnable[0] = false;
FX : MipFilter = LINEAR;
FX : Minfilter = LINEAR;
cgFX : Minfilter = LINEARMIPMAPLINEAR;
FX : float2 f2 = f3; //explicit cast
cgFX : float2 f2 = f3.xy;
with float3 f3;
FX : if (useSpecular) resColor += pow(reflection, specPower/5)*useSpecular*spec;
cgFX : resColor += (useSpecular)? pow(reflection, specPower/5)*spec :0;
FX : float4x4 wit : INV_TWORLD;
cgFX : float4x4 wi : INV_WORLD;
cgFX : static float4x4 wit = transpose(wi);
