Shaders in Cg?

I'm looking forward to learn shader programming and as far as i know, there a two ways to do that: MS's HLSL and nVidia's Cg.I don't know very much on this topic and I would like knowing what differences are there between them, and which is better to start with.

I already know well C/C++ syntax, so Cg seems to be an easiest way for me to go.

Anyway, will we be able to load Cg shaders into XNA?

[446 byte] By [KolRn] at [2008-2-21]
# 1

HLSL is the only way you will be able to run shaders on XNA, but don't worry, both Cg and HLSL started out life as the same language - you could easily take a shader in Cg and get it to run in HLSL. I still use my orignal nVidia CG shader book as a reference when writing HLSL.

Andy.

Postscript: You will also want to understand the effects (.fx) file format, which is where you will typically find the HLSL code. Good luck!

AndyL at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 2

Thanks for info, Andy. Glad to see that both languages are quite similar.

KolRn at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 3
Indeed... Cg seems to even mimic the .fx stuff with CgFX... so it should be totally simple to convert between platforms...
EvilOneSD at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...