Sign in to follow this  
stu2000

CG and MSVC++ 2008

Recommended Posts

Hey, i would like to continue this thread as Im having similar problems..

http://www.gamedev.net/community/forums/topic.asp?topic_id=537584

Im trying to get started with cg programming. I realise that it will be complicated and specialised, but Im desperate to try and utilize the power of the graphics card to accelerate certain computational areas of a new system/game.
I have simplified certain aspects down to basic cellular automata type calculations that I beleive would be well suited to GPU and textures for input/output http://en.wikipedia.org/wiki/Cellular_automaton .

I believe I have performed the steps in the thread, such as linking the include and lib directories, putting in the .libs in additional dependencies etc, but i dont know if MSVC++ 2008 has fully integrated or not.

I take it visual studio 2008 is referred to as just '8' from the nvidia installer?

If i right click the cg file i have created (called cgfile.cg) and click properties it states custom build step and i put under additional dependencies 'cg.lib' and 'cggl.lib'. The project compiles, but i never see the cgfile.cg get built or anything and i havent put in a custom command line in the properties.
I would love to know if A) the file works, B) how to build the file C) how to call/run the compiled cg prog from c++

atm my interface looks like this: you should be able to make out the cg file code.

Click here to view full size

Stu

Share this post


Link to post
Share on other sites
I am not a CG user (but a heavy user of GLSL which is a similar GPU language), so I may be wrong, but I will guess that these two languages are very similar.

I think this is compiled by the hardware compiler on board the GPU at runtime, not by MSVC. I believe that MSVC doesn't know anything about .cg files, you essentially have to read in your .cg files as strings during runtime and upload the literal character arrays to the GPU to parse/compile it.

At least that is how it works for GLSL. You may need to implement some OpenCL/OpenGL/DirectX functionality into your project to get access to these shader compiling functions.

Hope that helps, but I may be wrong, so check around first.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this