Archived

This topic is now archived and is closed to further replies.

Starting Cg

This topic is 5311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

alright i just bought the book "The Cg Tutorial" and i am LOVING it. it is teaching me everything i ever wanted to know about shaders. the only prob im havin is getting the programs to work. how do i compile them? can i do it through VC++? if so how? the theories are explained great but i just need to know how to run the programs. can someone help?

Share this post


Link to post
Share on other sites
What you need to do is read AppendixB: The Cg Runtime.

I also found this little text on the net.


Add a Custom Build Step for your Cg Shaders

A Custom Build Step allows you to use a specific tool to build your Cg shaders.
In this case, we're going to use the Cg compiler, cgc.exe.
The following are the steps you have to take to accomplish this:

1. Right click on a shader in the Cg Shaders folder created in the last step and select
Settings from the popup menu
2. Select All Configurations from the Settings For drop-down list box
3. Add cgc $(InputPath) -o $(InputName).vp -profile vp20 to the Commands textbox
4. Add $(InputName).vp to the Outputs textbox


--------------------------------------------------------------------------------

Syntax Highlighting

To help to increase the readability of your code, you can turn on syntax highlighting
when editing your Cg files in Visual Studio 6.0. Here's how:

1. Copy usertype.dat (included on the Cg CD) to the Visual Studio bin directory
(typically C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
2. Start regedit (Start -> Run -> regedit) and go to
HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Text Editor\Tabs/Language Settings\C/C++
3. Add cg to the end of the FileExtensions key (each extension in the list should be separated with a semicolon)
4. Restart Visual Studio

Your shaders should now have syntax highlighting.


BTW, should this post really be in the the NeHe forums?

[edited by - axodoss on June 3, 2003 2:26:39 AM]

Share this post


Link to post
Share on other sites