OGRE CG教程(二): 如何编译CG

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中的一个错误费尽苦心,以下的方法会让你轻松很多.


Table of contents


Step 1 - Install the compiler from Nvidia

Install the appropriate  CG Toolkit from NVidia (external link)  

(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   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

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








  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值