If you are a beginner trying to get into .cg you will quickly learn that it is pretty finicky; Much more picky than fixed function.
If you are running around in the dark trying to figure out what the hell is wrong with your .cg code, following these instructions will put an end to all that.
Table of contents
Install the appropriate CG Toolkit from NVidia
(download is near the bottom of the page)
When you first go through the installed files you find a file called
inside the directory:
C:\Program Files\NVIDIA Corporation\Cg\bin
Open your command shell (in Windows you can do it by typing 'cmd' inside Run...)
You can then use the following command lines to point it to whatever .cg files you want:
cgc -entry yourMainFP -profile ps_2_0 yourFile.cg
cgc -entry yourMainVP -profile vs_1_1 yourFile.cg
Next, you will probably find that either cgc.exe or your .cg file can't be located. That's because you need to set your current working directory.
I recommend setting the current directory to the location of your .cg file. If you are new to this you do it with the 'cd' command:
After that, now we are ready to run real commandlines, here is my final commandline:
"C:\Program Files\NVIDIA Corporation\Cg\bin\cgc.exe" -entry myVPentryPoint -profile vs_1_1 myFile.cg
If you would like to see the assembler generated when the cg is compiled use the '-l' command. Here's an example:
cgc -entry yourMainVP -profile vs_1_1 yourFile.cg -l assembler_output.txt