Nvidia's CG settings. edit: It's called "Syntax highlighting"
Hello,
When I drag a file to my visual studio 2005 express edition, for instance "pixelshader.cg", the keywords don't turn blue. I've seen other people who do have that, and I'd like to know how I can turn that on using Nvidia's CG.
To be clear, I mean that I want words like "float4 dot distance normalize" ect. to turn some color.
Thanks for the help.
edit: It's called "Syntax highlighting"
[Edited by - Dolf on May 24, 2008 10:13:58 AM]
Check the Cg folder in your Cg installation for instructions on how to do enble VS to recognize hlsl syntax. That folder is called: msdev_syntax_highlighting, and on my installation it is in following path:
C:\programs\NVIDIA Corporation\Cg\msdev_syntax_highlighting
Your path might be different, depending on where you installed the Cg.
Below are instructions, but you will need other contents from nvidia.
Want pretty syntax highlighting when editing your CG files in Visual Studio 6? Heres how:
1. Copy the usertype.dat file 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 (separated with a semicolon)
4. Restart Visual Studio and your shaders should now have syntax highlighting
NOTE: You can use the install_highlighting.reg file to simplify steps 2-3, just double click on the file and press Ok when prompted.
C:\programs\NVIDIA Corporation\Cg\msdev_syntax_highlighting
Your path might be different, depending on where you installed the Cg.
Below are instructions, but you will need other contents from nvidia.
Want pretty syntax highlighting when editing your CG files in Visual Studio 6? Heres how:
1. Copy the usertype.dat file 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 (separated with a semicolon)
4. Restart Visual Studio and your shaders should now have syntax highlighting
NOTE: You can use the install_highlighting.reg file to simplify steps 2-3, just double click on the file and press Ok when prompted.
I'm posting here because it doesn't seem to work. I must be doing something wrong.
I am using windows XP with visual studio 2005 express edition.
I am using windows XP with visual studio 2005 express edition.
that was USEFULL information; I just followed instructions and everything works fine with visual studio express 2008;
have you checked your tools->options->text editor->file extension
you have to add extensions that will be used with vs (.fx, .cg, .frag, .whatever_you_use_to_call_your_shaders)
You need to LEARN your tool and being able to discover some thing on your own. Nothing is more usefull then clicking on menus and looking around what options you have ...
By the way, I suggest writing shaders with emacs. Generally emacs will autoident and do more for your syntax then visual studio. I have written my own mode for writing shaders in emacs, you can get it here: www.nextpoint.se/cgfx-mode.zip.
For fast viewing of shaders I prefer open emacs since it is much smaller and comes up faster then VS too (it is almost as fast as notepad on my comp).
have you checked your tools->options->text editor->file extension
you have to add extensions that will be used with vs (.fx, .cg, .frag, .whatever_you_use_to_call_your_shaders)
You need to LEARN your tool and being able to discover some thing on your own. Nothing is more usefull then clicking on menus and looking around what options you have ...
By the way, I suggest writing shaders with emacs. Generally emacs will autoident and do more for your syntax then visual studio. I have written my own mode for writing shaders in emacs, you can get it here: www.nextpoint.se/cgfx-mode.zip.
For fast viewing of shaders I prefer open emacs since it is much smaller and comes up faster then VS too (it is almost as fast as notepad on my comp).
Alright sorry about that. I thought it would be enough.
Anyway, I read the readme.txt.
It said I had to copy the usertype.dat. So I did.
Then I proceeded with "Visual Studio 2005 / 8:". The registry keys it talked about weren't there.
So I figured it has to be the other. "Visual Studio 6:"
The path of the usertype.dat didn't match anything in my folders.
So now I just clicked all .reg files, and it's still not working.
Anyway, I read the readme.txt.
It said I had to copy the usertype.dat. So I did.
Then I proceeded with "Visual Studio 2005 / 8:". The registry keys it talked about weren't there.
So I figured it has to be the other. "Visual Studio 6:"
The path of the usertype.dat didn't match anything in my folders.
So now I just clicked all .reg files, and it's still not working.
"have you checked your tools->options->text editor->file extension
you have to add extensions that will be used with vs (.fx, .cg, .frag, .whatever_you_use_to_call_your_shaders)"
Oh my god! that was it!
Thanks thanks thanks! awesome!
Cheers, thanks for the help
you have to add extensions that will be used with vs (.fx, .cg, .frag, .whatever_you_use_to_call_your_shaders)"
Oh my god! that was it!
Thanks thanks thanks! awesome!
Cheers, thanks for the help
edit that file so that id does match your folder, be sure you have opened registry at correct key, and if it isn't there (in correct place) just make one.
I had to make one to get it to work with vs2008.
also add file extensions in opetions dialog as I wrote above.
I had to make one to get it to work with vs2008.
also add file extensions in opetions dialog as I wrote above.
Now that's solved,
How do I properly get the compiler warnings/errors using a custom build step? Now I have something like this in my code:
If I integrate custom build step in it, I'll get a "no program defined" error, but I don't want that error to stop me from running because it works perfectly fine without a program.
Edit: Let me just crank up your points on gamedev ;)
How do I properly get the compiler warnings/errors using a custom build step? Now I have something like this in my code:
//works fine, but needs compiler option /subsystem:Console for the outputvoid CheckShadersForErrors(char* name){ printf("\n"); char string[256]; memset(string,256,0); sprintf(string,"cgc.exe "); sprintf(string+8,name); system(string); printf("\n");}void Game::Init(){ CheckShadersForErrors("shaders\\pixelshader.cg"); //ect
If I integrate custom build step in it, I'll get a "no program defined" error, but I don't want that error to stop me from running because it works perfectly fine without a program.
Edit: Let me just crank up your points on gamedev ;)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement