Jump to content
  • Advertisement

Archived

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

skow

Does any one use Nvidia's Cg?

This topic is 5363 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

Ive been thinking about triing it out. But to learn it takes quite an investment. Has any one tried it? Any reasion not to use it? Is it worth triing? Thanks

Share this post


Link to post
Share on other sites
Advertisement
i use Cg. u are right though, it does take a long time to learn it. if u know c++ then you are ready to go. it just takes a while to get your head around the semantics and a lot of the effects it covers.
there is a forum that i found thats called cgshaders.org. everyone there programs with it.
one thing to remember... make sure you have ALL OF THE SEMICOLONS ( ; ) IN THE RIGHT PLACES!!! trust me. i thought my application was not loading the shader right. o well thats just me.
quick answer for you learn it. its much easier than using assembly.

[edited by - adam17 on October 12, 2003 1:42:44 AM]

Share this post


Link to post
Share on other sites
well u can do it one of two ways. you can run the vertex or fragment program through the cg compiler and get either a .vp or .fp file out of it which you load into your application. the other way is to compile the code at run time. doing it at run time you must include a lot of other files for the release.

Share this post


Link to post
Share on other sites
Ok cool. Is there a prefered tutorial for using cg? There is that one book, but i would like to try cg before investing money to get a book on it.

Poor college student syndrome

Share this post


Link to post
Share on other sites
I learned Cg, now I use HLSL. The two are based on the same syntax and libraries. DirectX takes care of the compilation for you. Other problem was that Cg wouldn''t compile any fragment shaders on my Radeon 9200 but HLSL would.

Tom

Share this post


Link to post
Share on other sites
I''m also using Cg. It''s very good and much easier than using ASM code. It''s just like normal C but with new data types such as vector floats and matrix floats and some graphics specific functions.
If you compile Cg code using the runtime method (you have to include header files and libraries) the runtime-compiler tries to improve the performance of your Cg shaders based on the hardware it runs on.
I bought NVidia''s "The Cg Tutorial" book and it is really helpful if you want to get into shader programming (using Cg), but you should already be familiar with C/C++. So you should get ahead with it even if you are a beginner (though I wouldn''t suggest beginners to start with shaders ) But I believe there are some tutorials on the net, too (check NVidia and Google for Cg/HLSL). adam17 already mentioned www.cgshaders.org, they have a good forum and some shader samples for you.

Share this post


Link to post
Share on other sites
its taken me a while to learn how to use them, but let me tell you this, its taken me a LONG time to learn it. i bought the book when it came out in early may. im still having a hard time getting some basics. of course the reason for that could be i have not spent day after day grinding it into my head. o well.

Share this post


Link to post
Share on other sites
quote:
Original post by skow
Any reasion not to use it?


Yes there is a 'reasion' at least : with Cg you can't fully control the GL state changes. That's a good point as well as a bad point.
The good point is that Cg handles everything for you (well, almost everything ). The bad point is that you can't fully optimize your engine since you don't know which GL calls are performed inside the Cg functions.

[edited by - vincoof on October 13, 2003 3:37:33 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!