OGRE CG教程(二): 如何编译CG
2014-08-15 19:45
148 查看
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.
如果你是一个学习CG的新手,你会很快的发现CG语言是非常讲究的,比其他语言要挑剔的多.
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.
如果你正在为找CG中的一个错误费尽苦心,以下的方法会让你轻松很多.
Step
1 - Install the compiler from Nvidia
步骤1:安装Nvidia的编译器
Step
2 - Using the CG Compiler (cgc.exe)
步骤2:用cgc.exe编译
Step
3 - Set local working directory
步骤3:设置本地工作目录
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 cgc.exe inside
the directory: C:\Program Files\NVIDIA Corporation\Cg\bin
当你第一次去浏览安装文件时候你会在C:\Program Files\NVIDIA Corporation\Cg\bin中找到cgc.exe
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:
你可以用以下命令你可以编译任何的cg文件
cgc -entry yourMainFP -profile ps_2_0 yourFile.cg
or
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:
我推荐设置当前的目录为你的cg的本地目录.如果你想用自己的目录,请使用cd命令.
cd "C:\Path\to\my\cg\file"
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:
如果你想看看生成过程,使用"-i"
cgc -entry yourMainVP -profile vs_1_1 yourFile.cg -l assembler_output.txt
如果你是一个学习CG的新手,你会很快的发现CG语言是非常讲究的,比其他语言要挑剔的多.
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.
如果你正在为找CG中的一个错误费尽苦心,以下的方法会让你轻松很多.
Table of contents
Step1 - Install the compiler from Nvidia
步骤1:安装Nvidia的编译器
Step
2 - Using the CG Compiler (cgc.exe)
步骤2:用cgc.exe编译
Step
3 - Set local working directory
步骤3:设置本地工作目录
Step 1 - Install the compiler from Nvidia
Install the appropriate CGToolkit from NVidia
(download is near the bottom of the page)
从上面链接处下载
Step 2 - Using the CG Compiler (cgc.exe)
When you first go through the installed files you find a file called cgc.exe insidethe directory: C:\Program Files\NVIDIA Corporation\Cg\bin
当你第一次去浏览安装文件时候你会在C:\Program Files\NVIDIA Corporation\Cg\bin中找到cgc.exe
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:
你可以用以下命令你可以编译任何的cg文件
cgc -entry yourMainFP -profile ps_2_0 yourFile.cg
or
cgc -entry yourMainVP -profile vs_1_1 yourFile.cg
Step 3 - Set local working directory
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:
我推荐设置当前的目录为你的cg的本地目录.如果你想用自己的目录,请使用cd命令.
cd "C:\Path\to\my\cg\file"
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:
如果你想看看生成过程,使用"-i"
cgc -entry yourMainVP -profile vs_1_1 yourFile.cg -l assembler_output.txt
相关文章推荐
- 手把手教你如何配置和编译ogre 1.7.0 + cegui 0.7.1
- 手把手教你如何配置和编译ogre 1.7.0 + cegui 0.7.1
- 在VS2008(VC9)中如何正确编译Ogre源码
- cg profiles,什么是profiles,以及如何使用CGC编译Cg语言
- 如何编译tizen源码(图文教程)?
- 如何编译ogre
- OGRE CG教程 (一):OGRE CG 基础
- 如何自己编译生成Ogre的API文档
- 手把手教你如何配置和编译ogre 1.7.0 + cegui 0.7.1
- [转]如何编译tizen源码(图文教程)?
- 手把手教你如何配置和编译ogre 1.7.0 + cegui 0.7.1
- Ogre 1.7.0,VS2005编译全过程傻瓜式教程
- cg profiles,什么是profiles,以及如何使用CGC编译Cg语言
- 在VS2008(VC9)中如何正确编译Ogre 1.7.2
- 手把手教你如何配置和编译ogre 1.7.0 + cegui 0.7.1
- Ogre 1.7.0,VS2005编译全过程傻瓜式教程
- 如何编译OGRE
- 手把手教你如何配置和编译ogre 1.7.0 + cegui 0.7.1
- 第二章 如何在VS2008里面编译CG
- Cg profiles,如何使用CGC编译Cg语言(转)