Sign in to follow this  
ATC

Cg Shader Language?

Recommended Posts

I've been a DirectX guy for quite a few years, but now that I'm working on a platform/API-agnostic engine, I'm getting my feet wet with OpenGL concepts and programming, learning to take my knowledge of DirectX and "convert" it to the OpenGL world. Sometimes this is rather hard! I find that the programming itself is the easiest part, whilst design decisions are the most difficult. And I'm stuck on yet another design decision!

I know that Cg shader language is compatible with DirectX [i]and[/i] OpenGL... This sounds quite appealing, as HLSL and GLSL are specific to DirectX and OpenGL, respectively. However, this wonderful rose seems to have its thorn too... I've been told that Cg is barely (or not at all) supported by nVidia anymore. Another person said "[it] was a good language, but never quite lived up to its expectations". I've also read in quite a few places that Cg doesn't even work correctly with most new cards, and only works well with older hardware... Is any of this true, or are these opinions/facts themselves incorrect and/or outdated?

I'd really like to know if Cg is competitive with HLSL and GLSL, as it was intended to be? Does it support modern shading features and new hardware? Is nVidia/Microsoft continuing to support and improve the language the way HLSL and GLSL are continuously supported/expanded? The reason I'd like to know is because I'm considering the idea of supporting Cg in my engine if it can indeed be every bit as good as the "native" shading languages of D3D and OGL...and work just as well with new hardware and modern shading techniques.

Any help or useful information you can give about this will be greatly appreciated and +1'ed!!!

Regards,

ATC

Share this post


Link to post
Share on other sites
Cg is obsolete.

GLSL and HLSL are very close conceptually, and it'd probably not be too much trouble to port from one to the other, or to even write some tools so that one source file in a third language could generate code for both -- perhaps using something as simple as a macro pre-processor or something like perl, sed or awk.

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